Пример #1
0
 /**
  * Called after each successful save operation.
  *
  * @param bool $created True if this save created a new record
  * @param array $options Options passed from Model::save().
  * @return void
  * @throws InternalErrorException
  * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#aftersave
  * @see Model::save()
  * @throws InternalErrorException
  */
 public function afterSave($created, $options = array())
 {
     //TopicFramesRoom登録
     if (isset($this->data['TopicFramesRoom'])) {
         $this->loadModels(['TopicFramesRoom' => 'Topics.TopicFramesRoom']);
         if (!$this->TopicFramesRoom->saveTopicFramesRoom($this->data)) {
             throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
         }
     }
     //TopicFramesPluginのチェック
     if (isset($this->data['TopicFramesPlugin'])) {
         $this->loadModels(['TopicFramesPlugin' => 'Topics.TopicFramesPlugin']);
         if (!$this->TopicFramesPlugin->saveTopicFramesPlugin($this->data)) {
             throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
         }
     }
     //TopicFramesBlockのチェック
     if (isset($this->data['TopicFramesBlock'])) {
         $this->loadModels(['TopicFramesBlock' => 'Topics.TopicFramesBlock']);
         if (!$this->TopicFramesBlock->saveTopicFramesBlock($this->data)) {
             throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
         }
     }
     parent::afterSave($created, $options);
 }