[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/repository/storage/ -> PhabricatorRepositoryBranch.php (source)

   1  <?php
   2  
   3  final class PhabricatorRepositoryBranch extends PhabricatorRepositoryDAO {
   4  
   5    protected $repositoryID;
   6    protected $name;
   7    protected $lintCommit;
   8  
   9    public function getConfiguration() {
  10      return array(
  11        self::CONFIG_COLUMN_SCHEMA => array(
  12          'name' => 'text128',
  13          'lintCommit' => 'text40?',
  14        ),
  15        self::CONFIG_KEY_SCHEMA => array(
  16          'repositoryID' => array(
  17            'columns' => array('repositoryID', 'name'),
  18            'unique' => true,
  19          ),
  20        ),
  21      ) + parent::getConfiguration();
  22    }
  23  
  24    public static function loadBranch($repository_id, $branch_name) {
  25      return id(new PhabricatorRepositoryBranch())->loadOneWhere(
  26        'repositoryID = %d AND name = %s',
  27        $repository_id,
  28        $branch_name);
  29    }
  30  
  31    public static function loadOrCreateBranch($repository_id, $branch_name) {
  32      $branch = self::loadBranch($repository_id, $branch_name);
  33      if ($branch) {
  34        return $branch;
  35      }
  36  
  37      return id(new PhabricatorRepositoryBranch())
  38        ->setRepositoryID($repository_id)
  39        ->setName($branch_name)
  40        ->save();
  41    }
  42  
  43  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1