Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Adderror In Beforesave Not Work When $Model->Save() In Loop

$
0
0
while insert multiple data, then $this->addError stop working.
for example in Controller:
foreach($roomfacilty as $data)
			{
		        $model->setIsNewRecord(true);
			$model->hostel_room_category_facility_id=null;
			$model->hostel_room_category_id=$_POST['HostelRoomCategoryFacility']['hostel_room_category_id'];
			$model->hostel_room_facility_id = $data;		
            		$model->hostel_room_category_facility_creation_date = new CDbExpression('NOW()');
			$model->save();			
			}


when as above data insert then it check validation properly in beforeSave() but not give error message(which is display through addError).

Thanks

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>