Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Need Help For Complex Has_Many Relation Criteria

$
0
0
Hi
How can I return the newest Post of the specific Author in Yii Blog Demo ??
in the User model we have
	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'posts' => array(self::HAS_MANY, 'Post', 'author_id'),
		);
	}


I dont want Hard coded m I just need a simple way because I need to access newest record many times
thanks a lot

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>