本文整理汇总了PHP中app\models\Post::className方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::className方法的具体用法?PHP Post::className怎么用?PHP Post::className使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Post
的用法示例。
在下文中一共展示了Post::className方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPost
/**
* @return \yii\db\ActiveQuery
*/
public function getPost()
{
return $this->hasOne(Post::className(), ['id' => 'post_id']);
}
示例2: getPosts
/**
* @return \yii\db\ActiveQuery
*/
public function getPosts()
{
return $this->hasMany(Post::className(), ['term_id' => 'id']);
}
示例3: getPosts
public function getPosts()
{
return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('post_category', ['category_id' => 'id']);
}
示例4: getAllPosts
public function getAllPosts()
{
return $this->hasMany(Post::className(), ['author_id' => 'id'])->orderBy(['is_top' => SORT_DESC, 'post_time' => SORT_DESC]);
}
示例5: getPosts
public function getPosts()
{
return $this->hasMany(Post::className(), ['cate_id' => 'id'])->asArray();
}
示例6: invalidateTags
/**
* Invalidate model tags.
* @return bool
*/
public function invalidateTags()
{
/** @var \DevGroup\TagDependencyHelper\TagDependencyTrait $this */
\yii\caching\TagDependency::invalidate($this->getTagDependencyCacheComponent(), [static::commonTag(), Post::commonTag(), $this->objectTag(), NamingHelper::getObjectTag(Post::className(), $this->getPrimaryKey())]);
return true;
}
示例7: getPosts
public function getPosts()
{
return $this->hasMany(Post::className(), ['cid' => 'id', 'status' => [Post::STATUS_PUBLISHED, Post::STATUS_HIDDEN]])->orderBy(['is_top' => SORT_DESC, 'post_time' => SORT_DESC]);
}