当前位置: 首页>>代码示例>>PHP>>正文


PHP Repository::setName方法代码示例

本文整理汇总了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");
 }
开发者ID:ratibus,项目名称:Crew,代码行数:57,代码来源:projectAddAction.class.php

示例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, '強制更新値の保存');
开发者ID:hidenorigoto,项目名称:sfjp-cms2,代码行数:31,代码来源:RepositoryTest.php

示例3: testJsonSerialize

 public function testJsonSerialize()
 {
     $commit = new Repository();
     $commit->setName('Name');
     $this->assertInternalType('array', $commit->jsonSerialize());
 }
开发者ID:afoozle,项目名称:github-webhook,代码行数:6,代码来源:RepositoryTest.php


注:本文中的Repository::setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。