is there a possibility to limit the rows of the arrays inside the object? the contain got an arrays of companies but i like to limit to first 10 only ,
public function view($id = null)
{
$warehouse = $this->Warehouses->get($id, [
'contain' => [' 'Companies'],
]);
$this->set('warehouse', $warehouse);
}
i tried but came out error [ Warning (2)](javascript:void(0);): Illegal offset type in isset or empty [ CORE/src/ORM/EagerLoader.php , line 410 ]
The syntax you’re looking for is here. The examples there are largely about adding “where” clauses to contain specific matches only, but you can also use “limit” or anything else that a query can include.
thank you very much, i will give it a try, from the cakephp side here, the data load is very heavy, at least 2000 rows in a table so when it loads via api, its very slow. im thinking of limiting the get data for getting 10 first, then the rest i create another function to load it slowing.
thank you very much for your help, i will try to learn the pagination icings, Zuluru array limiting part i have completed and ok, will update about the icings soon.
2000 rows in a table so when it loads via api, its very slow. im thinking of limiting the get data for getting 10 first, then the rest i create another function to load it slowing.