本文整理汇总了PHP中common\models\Post::className方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::className方法的具体用法?PHP Post::className怎么用?PHP Post::className使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common\models\Post
的用法示例。
在下文中一共展示了Post::className方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPosts
public function getPosts($isPublished = true)
{
$query = $this->hasMany(Post::className(), ['cid' => 'cid'])->with('categories')->with('tags')->with('author')->orderByCid();
if ($isPublished) {
$query = $query->published();
}
return $query->viaTable(Relationship::tableName(), ['mid' => 'mid']);
}
示例2: getPosts
/**
* @return \yii\db\ActiveQuery
*/
public function getPosts()
{
return $this->hasMany(Post::className(), ['category_id' => 'id']);
}
示例3: getCommentPost
/**
* @return \yii\db\ActiveQuery
*/
public function getCommentPost()
{
return $this->hasOne(Post::className(), ['id' => 'comment_post_id']);
}
示例4: getPosts
/**
* @return \yii\db\ActiveQuery
*/
public function getPosts()
{
return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('{{%term_relationship}}', ['term_id' => 'id']);
}
示例5: getMediaPost
/**
* @return \yii\db\ActiveQuery
*/
public function getMediaPost()
{
return $this->hasOne(Post::className(), ['id' => 'media_post_id']);
}
示例6: getIdPost
/**
* @return \yii\db\ActiveQuery
*/
public function getIdPost()
{
return $this->hasOne(Post::className(), ['id' => 'id_post']);
}
示例7: rules
/**
* @inheritdoc
*/
public function rules()
{
return [[['content'], 'filter', 'filter' => function ($value) {
return \Yii::$app->formatter->asHtml($value);
}], [['content', 'post_id'], 'required'], [['content'], 'string', 'max' => 128], [['post_id'], 'exist', 'targetClass' => Post::className(), 'targetAttribute' => 'id']];
}
示例8: getPosts
public function getPosts()
{
return $this->hasMany(Post::className(), ['cate_id' => 'id', 'status' => [Post::STATUS_ACTIVE]])->orderBy(['created_at' => SORT_DESC]);
}
示例9: getTopic
public function getTopic()
{
return $this->hasOne(Post::className(), ['id' => 'post_id'])->where(['type' => 'topic']);
}
示例10: getPosts
public function getPosts($isPublished = true)
{
$query = $this->hasMany(Post::className(), ['authorId' => 'uid'])->with('categories')->with('tags')->with('author')->orderByCid();
if ($isPublished) {
return $query->published();
}
return $query;
}
示例11: getPost
public function getPost()
{
return $this->hasOne(Post::className(), ['cid' => 'parent']);
}
示例12: getPosts
public function getPosts()
{
return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('category_post', ['category_id' => 'id']);
}