Feature: Choose branch

This commit is contained in:
Anatoly Skornyakov 2014-06-11 17:18:31 +04:00
commit 34a72006ae
4 changed files with 90 additions and 2 deletions

View file

@ -53,6 +53,7 @@ class ProjectBase extends Model
'id' => 'getId',
'title' => 'getTitle',
'reference' => 'getReference',
'branch' => 'getBranch',
'ssh_private_key' => 'getSshPrivateKey',
'ssh_public_key' => 'getSshPublicKey',
'type' => 'getType',
@ -72,6 +73,7 @@ class ProjectBase extends Model
'id' => 'setId',
'title' => 'setTitle',
'reference' => 'setReference',
'branch' => 'setBranch',
'ssh_private_key' => 'setSshPrivateKey',
'ssh_public_key' => 'setSshPublicKey',
'type' => 'setType',
@ -104,6 +106,11 @@ class ProjectBase extends Model
'length' => 250,
'default' => null,
),
'branch' => array(
'type' => 'varchar',
'length' => 250,
'default' => null,
),
'ssh_private_key' => array(
'type' => 'text',
'nullable' => true,
@ -192,6 +199,20 @@ class ProjectBase extends Model
return $rtn;
}
/**
* Get the value of Branch / branch.
*
* @return string
*/
public function getBranch()
{
if (empty($this->data['branch'])) {
return $this->getType() === 'hg' ? 'default' : 'master';
} else {
return $this->data['branch'];
}
}
/**
* Get the value of SshPrivateKey / ssh_private_key.
*
@ -336,6 +357,25 @@ class ProjectBase extends Model
$this->_setModified('reference');
}
/**
* Set the value of Branch / branch.
*
* Must not be null.
* @param $value string
*/
public function setBranch($value)
{
$this->_validateString('Branch', $value);
if ($this->data['branch'] === $value) {
return;
}
$this->data['branch'] = $value;
$this->_setModified('branch');
}
/**
* Set the value of SshPrivateKey / ssh_private_key.
*