1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-30 21:45:01 +03:00
ifhub.club/application/classes/modules/poll/entity/Answer.entity.class.php
2014-10-08 15:49:34 +07:00

56 lines
1.3 KiB
PHP

<?php
/*
* LiveStreet CMS
* Copyright © 2013 OOO "ЛС-СОФТ"
*
* ------------------------------------------------------
*
* Official site: www.livestreetcms.com
* Contact e-mail: office@livestreetcms.com
*
* GNU General Public License, version 2:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* ------------------------------------------------------
*
* @link http://www.livestreetcms.com
* @copyright 2013 OOO "ЛС-СОФТ"
* @author Maxim Mzhelskiy <rus.engine@gmail.com>
*
*/
/**
* Сущность ответа в опросе
*
* @package application.modules.poll
* @since 2.0
*/
class ModulePoll_EntityAnswer extends EntityORM
{
protected $aValidateRules = array(
array('title', 'string', 'allowEmpty' => false, 'min' => 1, 'max' => 250),
array('title', 'check_title'),
);
protected $aRelations = array(
'poll' => array(self::RELATION_TYPE_BELONGS_TO, 'ModulePoll_EntityPoll', 'poll_id'),
);
protected function beforeSave()
{
if ($bResult = parent::beforeSave()) {
if ($this->_isNew()) {
$this->setDateCreate(date("Y-m-d H:i:s"));
}
}
return $bResult;
}
public function ValidateCheckTitle()
{
$this->setTitle(htmlspecialchars($this->getTitle()));
return true;
}
}