Friday, January 1, 2010

Re: find method fetching all ids in single query


On 1 Jan 2010, at 12:56, engine wrote:


I am putting this in straight forward and simple manner

How to get the number of rows that corresponds to number of ids in a single
$this->Model->find() query

i mean i have one array of ids say
$list = array('0 => 125, 2 => 145, 3 => 458, ......so one) the second
parameter in this array is id from model table how can i fetch all of them
in single find query. I have tried to use OR condition but that doesnt allow
me to enter above array.

i would hazard you just need

array( 	"Model.id" => $list )

where $list is your array.


-- 
Mike Karthäuser
Managing Director - Brightstorm Ltd 
Email: mikek@brightstorm.co.uk 
Web: http://www.brightstorm.co.uk 
Tel: 07939 252144
Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

No comments: