2014-02-04 15:48:53 +02:00
|
|
|
<?php
|
2014-10-08 08:20:29 +03:00
|
|
|
/*
|
2014-02-04 15:48:53 +02:00
|
|
|
* 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>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-10-08 08:20:29 +03:00
|
|
|
/**
|
|
|
|
* Сущность ответа в опросе
|
|
|
|
*
|
|
|
|
* @package application.modules.poll
|
|
|
|
* @since 2.0
|
|
|
|
*/
|
2014-10-08 11:49:34 +03:00
|
|
|
class ModulePoll_EntityAnswer extends EntityORM
|
|
|
|
{
|
2014-02-04 15:48:53 +02:00
|
|
|
|
2014-10-08 11:49:34 +03:00
|
|
|
protected $aValidateRules = array(
|
|
|
|
array('title', 'string', 'allowEmpty' => false, 'min' => 1, 'max' => 250),
|
|
|
|
array('title', 'check_title'),
|
|
|
|
);
|
2014-02-04 15:48:53 +02:00
|
|
|
|
2014-10-08 11:49:34 +03:00
|
|
|
protected $aRelations = array(
|
|
|
|
'poll' => array(self::RELATION_TYPE_BELONGS_TO, 'ModulePoll_EntityPoll', 'poll_id'),
|
|
|
|
);
|
2014-02-04 15:48:53 +02:00
|
|
|
|
2014-10-08 11:49:34 +03:00
|
|
|
protected function beforeSave()
|
|
|
|
{
|
|
|
|
if ($bResult = parent::beforeSave()) {
|
|
|
|
if ($this->_isNew()) {
|
|
|
|
$this->setDateCreate(date("Y-m-d H:i:s"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $bResult;
|
|
|
|
}
|
2014-02-04 15:48:53 +02:00
|
|
|
|
2014-10-08 11:49:34 +03:00
|
|
|
public function ValidateCheckTitle()
|
|
|
|
{
|
|
|
|
$this->setTitle(htmlspecialchars($this->getTitle()));
|
|
|
|
return true;
|
|
|
|
}
|
2014-02-04 15:48:53 +02:00
|
|
|
|
|
|
|
}
|