php-censor/src/PHPCensor/Model/ProjectGroup.php

113 lines
1.9 KiB
PHP
Raw Normal View History

2015-10-08 17:33:01 +02:00
<?php
2016-07-19 20:28:11 +02:00
namespace PHPCensor\Model;
2015-10-08 17:33:01 +02:00
2017-02-16 13:45:50 +01:00
use PHPCensor\Model;
use b8\Store\Factory;
2015-10-08 17:33:01 +02:00
2017-02-16 13:45:50 +01:00
class ProjectGroup extends Model
2015-10-08 17:33:01 +02:00
{
2017-02-16 13:45:50 +01:00
/**
* @var array
*/
public static $sleepable = [];
/**
* @var string
*/
protected $tableName = 'project_group';
/**
* @var string
*/
protected $modelName = 'ProjectGroup';
/**
* @var array
*/
protected $data = [
'id' => null,
'title' => null,
];
/**
* @var array
*/
protected $getters = [
'id' => 'getId',
'title' => 'getTitle',
];
/**
* @var array
*/
protected $setters = [
'id' => 'setId',
'title' => 'setTitle',
];
/**
* @return int
*/
public function getId()
{
$rtn = $this->data['id'];
2017-02-16 13:45:50 +01:00
return $rtn;
}
/**
* @return string
*/
public function getTitle()
{
$rtn = $this->data['title'];
2017-02-16 13:45:50 +01:00
return $rtn;
}
/**
* @param $value int
*/
public function setId($value)
{
$this->validateNotNull('id', $value);
$this->validateInt('id', $value);
2017-02-16 13:45:50 +01:00
if ($this->data['id'] === $value) {
return;
}
$this->data['id'] = $value;
$this->setModified('id');
}
/**
* @param $value string
*/
public function setTitle($value)
{
$this->validateNotNull('title', $value);
$this->validateString('title', $value);
2017-02-16 13:45:50 +01:00
if ($this->data['title'] === $value) {
return;
}
$this->data['title'] = $value;
$this->setModified('title');
}
/**
* Get Project models by GroupId for this ProjectGroup.
*
* @return \PHPCensor\Model\Project[]
*/
public function getGroupProjects()
{
return Factory::getStore('Project', 'PHPCensor')->getByGroupId($this->getId(), false);
}
2015-10-08 17:33:01 +02:00
}