public static function getPostProperties($id) { if (isset(static::$properties[$id])) { return static::$properties[$id]; } $list = PostPropertyRel::join(PostProperty::getTableName(), PostProperty::getField('id'), '=', PostPropertyRel::getField('post_property_id'))->where(PostPropertyRel::getField('post_id'), $id)->remember(SettingsModel::one('cachelife'))->get(); $names = array(); foreach ($list as $item) { $names[] = $item->key; } static::$properties[$id] = $names; return $names; }
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(); }