phpci/PHPCI/Model/Base/ProjectBase.php

222 lines
3.8 KiB
PHP
Raw Normal View History

2013-05-03 17:02:53 +02:00
<?php
/**
* Project base model for table: project
*/
namespace PHPCI\Model\Base;
use b8\Model;
/**
* Project Base Model
*/
class ProjectBase extends Model
{
public static $sleepable= array();
protected $_tableName = 'project';
protected $_modelName = 'Project';
protected $_data = array(
'id' => null,
'title' => null,
2013-05-10 13:28:43 +02:00
'reference' => null,
2013-05-03 17:02:53 +02:00
'git_key' => null,
2013-05-10 13:28:43 +02:00
'type' => null,
2013-05-03 17:02:53 +02:00
);
protected $_getters = array(
'id' => 'getId',
'title' => 'getTitle',
2013-05-10 13:28:43 +02:00
'reference' => 'getReference',
2013-05-03 17:02:53 +02:00
'git_key' => 'getGitKey',
2013-05-10 13:28:43 +02:00
'type' => 'getType',
2013-05-03 17:02:53 +02:00
);
protected $_setters = array(
'id' => 'setId',
'title' => 'setTitle',
2013-05-10 13:28:43 +02:00
'reference' => 'setReference',
2013-05-03 17:02:53 +02:00
'git_key' => 'setGitKey',
2013-05-10 13:28:43 +02:00
'type' => 'setType',
2013-05-03 17:02:53 +02:00
);
public $columns = array(
'id' => array(
'type' => 'int',
'length' => '11',
'primary_key' => true,
'auto_increment' => true,
),
'title' => array(
'type' => 'varchar',
'length' => '250',
),
2013-05-10 13:28:43 +02:00
'reference' => array(
2013-05-03 17:02:53 +02:00
'type' => 'varchar',
2013-05-10 13:28:43 +02:00
'length' => '250',
2013-05-03 17:02:53 +02:00
),
'git_key' => array(
'type' => 'text',
'length' => '',
2013-05-10 13:28:43 +02:00
),
'type' => array(
'type' => 'varchar',
'length' => '50',
2013-05-03 17:02:53 +02:00
),
);
public $indexes = array(
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
);
public $foreignKeys = array(
);
public function getId()
{
$rtn = $this->_data['id'];
return $rtn;
}
public function getTitle()
{
$rtn = $this->_data['title'];
return $rtn;
}
2013-05-10 13:28:43 +02:00
public function getReference()
2013-05-03 17:02:53 +02:00
{
2013-05-10 13:28:43 +02:00
$rtn = $this->_data['reference'];
2013-05-03 17:02:53 +02:00
return $rtn;
}
public function getGitKey()
{
$rtn = $this->_data['git_key'];
return $rtn;
}
2013-05-10 13:28:43 +02:00
public function getType()
{
$rtn = $this->_data['type'];
return $rtn;
}
2013-05-03 17:02:53 +02:00
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');
}
public function setTitle($value)
{
$this->_validateNotNull('Title', $value);
$this->_validateString('Title', $value);
if($this->_data['title'] == $value)
{
return;
}
$this->_data['title'] = $value;
$this->_setModified('title');
}
2013-05-10 13:28:43 +02:00
public function setReference($value)
2013-05-03 17:02:53 +02:00
{
2013-05-10 13:28:43 +02:00
$this->_validateNotNull('Reference', $value);
$this->_validateString('Reference', $value);
if($this->_data['reference'] == $value)
2013-05-03 17:02:53 +02:00
{
return;
}
2013-05-10 13:28:43 +02:00
$this->_data['reference'] = $value;
2013-05-03 17:02:53 +02:00
2013-05-10 13:28:43 +02:00
$this->_setModified('reference');
2013-05-03 17:02:53 +02:00
}
public function setGitKey($value)
{
$this->_validateNotNull('GitKey', $value);
$this->_validateString('GitKey', $value);
if($this->_data['git_key'] == $value)
{
return;
}
$this->_data['git_key'] = $value;
$this->_setModified('git_key');
}
2013-05-10 13:28:43 +02:00
public function setType($value)
{
$this->_validateNotNull('Type', $value);
$this->_validateString('Type', $value);
if($this->_data['type'] == $value)
{
return;
}
$this->_data['type'] = $value;
$this->_setModified('type');
}
2013-05-03 17:02:53 +02:00
/**
* Get Build models by ProjectId for this Project.
*
* @uses \PHPCI\Store\BuildStore::getByProjectId()
* @uses \PHPCI\Model\Build
* @return \PHPCI\Model\Build[]
*/
public function getProjectBuilds()
{
return \b8\Store\Factory::getStore('Build')->getByProjectId($this->getId());
}
}