how to load model with findAll and return model

Hello master … i have code like this

	public function loadWarehouseStock($wid,$pid)



			'condition'=>'warehouse_id=:vwid AND product_id=:vpid',

			'params'=>array(':vwid'=>$wid, ':vpid'=>$pid),






			foreach($models as $model)




		return $stock;


the problem i can’t get stock becouse the return value is array. how I will get $stock as WarehouseStock, and create new value then i will update the value of stock…

Umm … I don’t quite follow your logic. Why do you use findAll() and then get the last one (again) with findByPK()?

Can’t you just use findByAttributes()?

Ok thank … i have found the solve… I read doc … i use find(),

thank for respond