Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / repository / storage / PhabricatorRepositoryBranch.php
blob4d7b76051a062585ab0ebc89b8b6067c2b14c2a2
1 <?php
3 final class PhabricatorRepositoryBranch extends PhabricatorRepositoryDAO {
5 protected $repositoryID;
6 protected $name;
7 protected $lintCommit;
9 protected function getConfiguration() {
10 return array(
11 self::CONFIG_COLUMN_SCHEMA => array(
12 'name' => 'text128',
13 'lintCommit' => 'text40?',
15 self::CONFIG_KEY_SCHEMA => array(
16 'repositoryID' => array(
17 'columns' => array('repositoryID', 'name'),
18 'unique' => true,
21 ) + parent::getConfiguration();
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);
31 public static function loadOrCreateBranch($repository_id, $branch_name) {
32 $branch = self::loadBranch($repository_id, $branch_name);
33 if ($branch) {
34 return $branch;
37 return id(new PhabricatorRepositoryBranch())
38 ->setRepositoryID($repository_id)
39 ->setName($branch_name)
40 ->save();