Adding project groups
This commit is contained in:
parent
70db830065
commit
522eaef825
18 changed files with 695 additions and 72 deletions
168
PHPCI/Model/Base/ProjectGroupBase.php
Normal file
168
PHPCI/Model/Base/ProjectGroupBase.php
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ProjectGroup base model for table: project_group
|
||||
*/
|
||||
|
||||
namespace PHPCI\Model\Base;
|
||||
|
||||
use PHPCI\Model;
|
||||
use b8\Store\Factory;
|
||||
|
||||
/**
|
||||
* ProjectGroup Base Model
|
||||
*/
|
||||
class ProjectGroupBase extends Model
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public static $sleepable = array();
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'project_group';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $modelName = 'ProjectGroup';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array(
|
||||
'id' => null,
|
||||
'title' => null,
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $getters = array(
|
||||
// Direct property getters:
|
||||
'id' => 'getId',
|
||||
'title' => 'getTitle',
|
||||
|
||||
// Foreign key getters:
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $setters = array(
|
||||
// Direct property setters:
|
||||
'id' => 'setId',
|
||||
'title' => 'setTitle',
|
||||
|
||||
// Foreign key setters:
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
'id' => array(
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'primary_key' => true,
|
||||
'auto_increment' => true,
|
||||
'default' => null,
|
||||
),
|
||||
'title' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 100,
|
||||
'default' => null,
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $indexes = array(
|
||||
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $foreignKeys = array(
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
$rtn = $this->data['id'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Title / title.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
$rtn = $this->data['title'];
|
||||
|
||||
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 Title / title.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
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');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Project models by GroupId for this ProjectGroup.
|
||||
*
|
||||
* @uses \PHPCI\Store\ProjectStore::getByGroupId()
|
||||
* @uses \PHPCI\Model\Project
|
||||
* @return \PHPCI\Model\Project[]
|
||||
*/
|
||||
public function getGroupProjects()
|
||||
{
|
||||
return Factory::getStore('Project', 'PHPCI')->getByGroupId($this->getId());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue