php-censor/src/Model/Base/ProjectGroup.php
2018-03-11 10:56:36 +07:00

127 lines
2.3 KiB
PHP

<?php
namespace PHPCensor\Model\Base;
use PHPCensor\Model;
class ProjectGroup extends Model
{
/**
* @var string
*/
protected $tableName = 'project_group';
/**
* @var array
*/
protected $data = [
'id' => null,
'title' => null,
'create_date' => null,
'user_id' => 0,
];
/**
* @return integer
*/
public function getId()
{
return (integer)$this->data['id'];
}
/**
* @param integer $value
*/
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');
}
/**
* @return string
*/
public function getTitle()
{
return $this->data['title'];
}
/**
* @param string $value
*/
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');
}
/**
* @return \DateTime|null
*/
public function getCreateDate()
{
if ($this->data['create_date']) {
return new \DateTime($this->data['create_date']);
}
return null;
}
/**
* @param \DateTime $value
*/
public function setCreateDate(\DateTime $value)
{
$stringValue = $value->format('Y-m-d H:i:s');
if ($this->data['create_date'] === $stringValue) {
return;
}
$this->data['create_date'] = $stringValue;
$this->setModified('create_date');
}
/**
* @return string
*/
public function getUserId()
{
return (integer)$this->data['user_id'];
}
/**
* @param integer $value
*/
public function setUserId($value)
{
$this->validateNotNull('user_id', $value);
$this->validateInt('user_id', $value);
if ($this->data['user_id'] === $value) {
return;
}
$this->data['user_id'] = $value;
$this->setModified('user_id');
}
}