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…

From your code is not clear to me what you want to accomplish… why the foreach loop that in the end gets only the last ID…

findAll() returns an array… can you use find()?

thanks for share, I re-read tutorials and documents, and I have gained a complete explanation. Yesterday I was just in a hurry and forget to read the manual yii