public function afterSave($insert, $changedAttributes) { parent::afterSave($insert, $changedAttributes); $beforeCount = $afterCount = false; if ($insert) { $beforeCount = false; $afterCount = $this->status == static::STATUS_PUBLISH; } else { if (isset($changedAttributes['status'])) { $beforeCount = $changedAttributes['status'] == static::STATUS_PUBLISH; $afterCount = $this->status == static::STATUS_PUBLISH; } } $this->insertCategories($this->inputCategories, $beforeCount, $afterCount); $this->insertTags($this->inputTags, $beforeCount, $afterCount); $this->insertAttachment($this->inputAttachments); }
public function afterSave($insert, $changedAttributes) { parent::afterSave($insert, $changedAttributes); $this->insertAttachment($this->inputAttachments); }