null, 'project_id' => null, 'commit_id' => null, 'status' => null, 'log' => null, 'branch' => null, 'created' => null, 'started' => null, 'finished' => null, 'plugins' => null, ); /** * @var array */ protected $_getters = array( 'id' => 'getId', 'project_id' => 'getProjectId', 'commit_id' => 'getCommitId', 'status' => 'getStatus', 'log' => 'getLog', 'branch' => 'getBranch', 'created' => 'getCreated', 'started' => 'getStarted', 'finished' => 'getFinished', 'plugins' => 'getPlugins', 'Project' => 'getProject', ); /** * @var array */ protected $_setters = array( 'id' => 'setId', 'project_id' => 'setProjectId', 'commit_id' => 'setCommitId', 'status' => 'setStatus', 'log' => 'setLog', 'branch' => 'setBranch', 'created' => 'setCreated', 'started' => 'setStarted', 'finished' => 'setFinished', 'plugins' => 'setPlugins', 'Project' => 'setProject', ); /** * @var array */ public $columns = array( 'id' => array( 'type' => 'int', 'length' => '11', 'primary_key' => true, 'auto_increment' => true, ), 'project_id' => array( 'type' => 'int', 'length' => '11', ), 'commit_id' => array( 'type' => 'varchar', 'length' => '50', ), 'status' => array( 'type' => 'tinyint', 'length' => '4', ), 'log' => array( 'type' => 'text', 'length' => '', 'nullable' => true, ), 'branch' => array( 'type' => 'varchar', 'length' => '50', ), 'created' => array( 'type' => 'datetime', 'length' => '', 'nullable' => true, ), 'started' => array( 'type' => 'datetime', 'length' => '', 'nullable' => true, ), 'finished' => array( 'type' => 'datetime', 'length' => '', 'nullable' => true, ), 'plugins' => array( 'type' => 'text', 'length' => '', 'nullable' => true, ), ); /** * @var array */ public $indexes = array( 'PRIMARY' => array('unique' => true, 'columns' => 'id'), 'project_id' => array('columns' => 'project_id'), 'idx_status' => array('columns' => 'status'), ); /** * @var array */ public $foreignKeys = array( 'build_ibfk_1' => array('local_col' => 'project_id', 'update' => 'CASCADE', 'delete' => 'CASCADE', 'table' => 'project', 'col' => 'id'), ); /** * Get the value of Id / id. * * @return int */ public function getId() { $rtn = $this->_data['id']; return $rtn; } /** * Get the value of ProjectId / project_id. * * @return int */ public function getProjectId() { $rtn = $this->_data['project_id']; return $rtn; } /** * Get the value of CommitId / commit_id. * * @return string */ public function getCommitId() { $rtn = $this->_data['commit_id']; return $rtn; } /** * Get the value of Status / status. * * @return int */ public function getStatus() { $rtn = $this->_data['status']; return $rtn; } /** * Get the value of Log / log. * * @return string */ public function getLog() { $rtn = $this->_data['log']; return $rtn; } /** * Get the value of Branch / branch. * * @return string */ public function getBranch() { $rtn = $this->_data['branch']; return $rtn; } /** * Get the value of Created / created. * * @return \DateTime */ public function getCreated() { $rtn = $this->_data['created']; if(!empty($rtn)) { $rtn = new \DateTime($rtn); } return $rtn; } /** * Get the value of Started / started. * * @return \DateTime */ public function getStarted() { $rtn = $this->_data['started']; if(!empty($rtn)) { $rtn = new \DateTime($rtn); } return $rtn; } /** * Get the value of Finished / finished. * * @return \DateTime */ public function getFinished() { $rtn = $this->_data['finished']; if(!empty($rtn)) { $rtn = new \DateTime($rtn); } return $rtn; } /** * Get the value of Plugins / plugins. * * @return string */ public function getPlugins() { $rtn = $this->_data['plugins']; return $rtn; } /** * Set the value of Id / id. * * Must not be null. * @param $value int */ public function setId($value) { $this->_validateNotNull('Id', $value); $this->_validateInt('Id', $value); if($this->_data['id'] === $value) { return; } $this->_data['id'] = $value; $this->_setModified('id'); } /** * Set the value of ProjectId / project_id. * * Must not be null. * @param $value int */ public function setProjectId($value) { $this->_validateNotNull('ProjectId', $value); $this->_validateInt('ProjectId', $value); if($this->_data['project_id'] === $value) { return; } $this->_data['project_id'] = $value; $this->_setModified('project_id'); } /** * Set the value of CommitId / commit_id. * * Must not be null. * @param $value string */ public function setCommitId($value) { $this->_validateNotNull('CommitId', $value); $this->_validateString('CommitId', $value); if($this->_data['commit_id'] === $value) { return; } $this->_data['commit_id'] = $value; $this->_setModified('commit_id'); } /** * Set the value of Status / status. * * Must not be null. * @param $value int */ public function setStatus($value) { $this->_validateNotNull('Status', $value); $this->_validateInt('Status', $value); if($this->_data['status'] === $value) { return; } $this->_data['status'] = $value; $this->_setModified('status'); } /** * Set the value of Log / log. * * @param $value string */ public function setLog($value) { $this->_validateString('Log', $value); if($this->_data['log'] === $value) { return; } $this->_data['log'] = $value; $this->_setModified('log'); } /** * Set the value of Branch / branch. * * Must not be null. * @param $value string */ public function setBranch($value) { $this->_validateNotNull('Branch', $value); $this->_validateString('Branch', $value); if($this->_data['branch'] === $value) { return; } $this->_data['branch'] = $value; $this->_setModified('branch'); } /** * Set the value of Created / created. * * @param $value \DateTime */ public function setCreated($value) { $this->_validateDate('Created', $value); if($this->_data['created'] === $value) { return; } $this->_data['created'] = $value; $this->_setModified('created'); } /** * Set the value of Started / started. * * @param $value \DateTime */ public function setStarted($value) { $this->_validateDate('Started', $value); if($this->_data['started'] === $value) { return; } $this->_data['started'] = $value; $this->_setModified('started'); } /** * Set the value of Finished / finished. * * @param $value \DateTime */ public function setFinished($value) { $this->_validateDate('Finished', $value); if($this->_data['finished'] === $value) { return; } $this->_data['finished'] = $value; $this->_setModified('finished'); } /** * Set the value of Plugins / plugins. * * @param $value string */ public function setPlugins($value) { $this->_validateString('Plugins', $value); if($this->_data['plugins'] === $value) { return; } $this->_data['plugins'] = $value; $this->_setModified('plugins'); } /** * Get the Project model for this Build by Id. * * @uses \PHPCI\Store\ProjectStore::getById() * @uses \PHPCI\Model\Project * @return \PHPCI\Model\Project */ public function getProject() { $key = $this->getProjectId(); if(empty($key)) { return null; } $cacheKey = 'Cache.Project.' . $key; $rtn = $this->registry->get($cacheKey, null); if(empty($rtn)) { $rtn = \b8\Store\Factory::getStore('Project')->getById($key); $this->registry->set($cacheKey, $rtn); } return $rtn; } /** * Set Project - Accepts an ID, an array representing a Project or a Project model. * * @param $value mixed */ public function setProject($value) { // Is this an instance of Project? if($value instanceof \PHPCI\Model\Project) { return $this->setProjectObject($value); } // Is this an array representing a Project item? if(is_array($value) && !empty($value['id'])) { return $this->setProjectId($value['id']); } // Is this a scalar value representing the ID of this foreign key? return $this->setProjectId($value); } /** * Set Project - Accepts a Project model. * * @param $value \PHPCI\Model\Project */ public function setProjectObject(\PHPCI\Model\Project $value) { return $this->setProjectId($value->getId()); } }