Пример #1
0
 /**
  * @param $postId
  * @return \PostAttachments[] | null
  */
 public static function getPostAttachments($postId)
 {
     return (array) \PostAttachments::findByPostId($postId);
 }
Пример #2
0
 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();
 }