/** * @param $postId * @return \PostAttachments[] | null */ public static function getPostAttachments($postId) { return (array) \PostAttachments::findByPostId($postId); }
protected function _afterDelete() { parent::_afterDelete(); \PostImages::write()->delete(PostImages::getTableName())->where('`post_id`=:post_id')->setParameter(':post_id', $this->getId(), \PDO::PARAM_INT)->execute(); \PostCustomFields::write()->delete(PostCustomFields::getTableName())->where('`post_id`=:post_id')->setParameter(':post_id', $this->getId(), \PDO::PARAM_INT)->execute(); \PostAttachments::write()->delete(PostAttachments::getTableName())->where('`post_id`=:post_id')->setParameter(':post_id', $this->getId(), \PDO::PARAM_INT)->execute(); \PostProperty::write()->delete(PostProperty::getTableName())->where('`post_id`=:post_id')->setParameter(':post_id', $this->getId(), \PDO::PARAM_INT)->execute(); }