本文整理汇总了PHP中Repository::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::setName方法的具体用法?PHP Repository::setName怎么用?PHP Repository::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Repository
的用法示例。
在下文中一共展示了Repository::setName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @throws Exception
* @param $request
* @return void
*/
public function execute($request)
{
$this->form = new RepositoryForm();
$name = $request->getParameter('name');
$remote = $request->getParameter('remote');
// get the propel connection
$con = Propel::getConnection();
$con->beginTransaction();
$message = '';
try {
if ($name && $remote) {
$repositoryPath = Configuration::get('repositories_path');
$repositoryName = $name;
$repository = sprintf('%s/%s', $repositoryPath, $repositoryName);
if (!$this->checkLocalRepository($repository, $remote)) {
throw new Exception(sprintf("Existing remote is different from remote you want '%s'", $remote));
} else {
$projectStatus = $this->getProjectStatus($name, $remote);
switch ($projectStatus) {
case -1:
$newProject = new Repository();
$newProject->setName($name)->setRemote($remote)->setValue($repositoryName)->save();
$message = sprintf("The project has been added successfully");
break;
case 0:
throw new Exception(sprintf("A project already exists and conflicts with project you want to add (name: %s, remote: %s)", $name, $remote));
break;
default:
throw new Exception(sprintf("Project '%s' (remote: %s) already exists", $name, $remote));
break;
}
if (!is_dir($repository)) {
$cloneStatus = $this->gitCommand->cloneRepository($remote, $repository);
if ($cloneStatus === 0) {
$message .= sprintf(" and remote '%s' is correctly cloned in '%s'", $remote, $repository);
$this->getUser()->setFlash('notice', $message);
} else {
$message .= sprintf(" but remote '%s' is not cloned in '%s' [status : %s]", $remote, $repository, $cloneStatus === null ? 'NULL' : $cloneStatus);
throw new Exception($message);
}
}
}
} else {
throw new Exception(sprintf("Parameter name ('%s') or remote ('%s') not found", $name, $remote));
}
$con->commit();
} catch (Exception $e) {
$con->rollBack();
$this->getUser()->setFlash('error', $e->getMessage());
}
$this->redirect("default/repositoryList");
}
示例2: sfDatabaseManager
}
}
sfForm::enableCSRFProtection();
$context = sfContext::getInstance(array('controller' => 'myController', 'request' => 'myRequest'));
// test環境でDB初期化
$configuration = ProjectConfiguration::getApplicationConfiguration('taskapp', 'test', true);
new sfDatabaseManager($configuration);
Doctrine_Core::loadData(dirname(__FILE__) . '/RepositoryFixture.yml');
$t = new lime_test(28);
// construct
$t->diag('__construct()');
$t->ok(new Repository() instanceof Repository, 'Repositoryインスタンス化');
// create
$t->diag('create');
$repository = new Repository();
$repository->setName('repository_name');
$repository->setRepository('repository_url');
$repository->setSubdirectory('subdirectory');
$repository->setBindPath('/bind_path');
$repository->setSettingsJson('settings_json');
$repository->setForceUpdate(true);
$repository->setForceClone(true);
$repository->save();
$repository = RepositoryTable::getInstance()->findOneByName('repository_name');
$t->ok($repository instanceof Repository, 'Repository保存');
$t->is($repository->getName(), 'repository_name', 'リポジトリ名の保存');
$t->is($repository->getRepository(), 'repository_url', 'リポジトリURLの保存');
$t->is($repository->getSubdirectory(), 'subdirectory', 'サブディレクトリの保存');
$t->is($repository->getBindPath(), '/bind_path', '結合パスの保存');
$t->is($repository->getSettingsJson(), 'settings_json', '設定値の保存');
$t->is($repository->getForceUpdate(), true, '強制更新値の保存');
示例3: testJsonSerialize
public function testJsonSerialize()
{
$commit = new Repository();
$commit->setName('Name');
$this->assertInternalType('array', $commit->jsonSerialize());
}