I'm using elasticsearch with Active Records in Yii2.
static function getPosts()
{
return Post::find()
->orderBy('ID desc')
->all();
}
The method find () works fine, but if I add the method limit(), it stops working.
static function getPosts()
{
return Post::find()
->orderBy('ID desc')
->limit(20)
->all();
}
How I can use in a query limit with Active Records, Elasticsearch and Yii2?
Regards.
Noup.
Active Records is not compatible whit limit() function.
You have to use query() function for this.