* @author Shohei Nakajima * @link http://www.netcommons.org NetCommons Project * @license http://www.netcommons.org/license.txt NetCommons License * @copyright Copyright 2014, NetCommons Project */ App::uses('BlockBaseModel', 'Blocks.Model'); App::uses('BlockSettingBehavior', 'Blocks.Model/Behavior'); /** * RssReaderSetting Model * * @author Shohei Nakajima * @package NetCommons\RssReaders\Model */ class RssReaderSetting extends BlockBaseModel { /** * Custom database table name * * @var string */ public $useTable = false; /** * Validation rules * * @var array */ public $validate = array(); /** * use behaviors * * @var array */ public $actsAs = array( 'Blocks.BlockRolePermission', 'Blocks.BlockSetting' => array( BlockSettingBehavior::FIELD_USE_WORKFLOW, ), ); /** * RssReaderSettingデータ取得 * * @return array * @see BlockSettingBehavior::getBlockSetting() 取得 */ public function getRssReaderSetting() { return $this->getBlockSetting(); } /** * RssReaderSettingデータ登録 * * @param array $data リクエストデータ * @return bool * @throws InternalErrorException */ public function saveRssReaderSetting($data) { //トランザクションBegin $this->begin(); //バリデーション $this->set($data); if (! $this->validates()) { return false; } try { $this->save(null, false); //トランザクションCommit $this->commit(); } catch (Exception $ex) { //トランザクションRollback $this->rollback($ex); } return true; } }