/** * prepareExecute * * @return void */ protected function prepareExecute() { parent::prepareExecute(); $this->record->load($this->data['id']); $this->category = $this->model->getRecord('Category'); $this->category->load($this->record->category_id); }
/** * postSave * * @param Data $data * * @return void */ protected function postSave(Data $data) { $this->post = $data; $this->topic = $topic = $this->model->getRecord('Topic'); $topic->load($data->topic_id); $this->category = $this->model->getRecord('Category'); $this->category->load($topic->category_id); if ($this->isNew) { if (!$data->primary) { $user = User::get(); $date = DateTime::create(); $topic->last_reply_user = $user->id; $topic->last_reply_post = $data->id; $topic->last_reply_date = $date->toSql(); $topic->replies++; $topic->store(); } else { $this->category->topics++; } $this->category->posts++; $this->category->store(); } // Mail $this->sendMail($topic, $data); // Add Notification Notification::addNotification('topic', $topic->id, $topic->user_id); }
/** * prepareExecute * * @return void */ protected function prepareExecute() { parent::prepareExecute(); $this->useTransaction(true); if (isset($this->data['id'])) { $this->record->load($this->data['id']); } $this->catid = $this->input->get('category'); $this->category = new CategoryRecord(); $this->category->load($this->catid); $this->data['category_id'] = $this->catid; }
/** * Method to test rebuildPath(). * * @return void * * @covers Windwalker\Record\NestedRecord::rebuildPath */ public function testRebuildPath() { $this->instance->load(4)->rebuildPath(); $this->assertEquals('flower/olive', $this->instance->path); }