model->delete() not returning boolean value

I can’t tell if it is my programming or a bug in the framework, I expect that the delete method will return true or false depending on the success of the operation.

The code works as intended (it deletes the rows) but my code dies because error flags are being set.




$errs = 0;

// there can be quite a few rows that match these conditions so I delete them in a loop

foreach ($eventRecords as $record){

$transactionRecord=EventParticipant::model()->findByPk($record->EventParticipantID);

       if( $transactionRecord->delete()){

        // All good			

			} else; {

			    ++$errs;

			}

}

// now check if we had errors

if($errs > 0){

die("There were $errs errors ");

} else {

    Yii::app()->request->redirect(Yii::app()->user->returnUrl);

}



this doesn’t work either




if( !$transactionRecord->delete()){

..}



so I am confused :blink: doodle

You have a semicolon after else.

/Tommy

Duh!

thanks man, long day!

Oh the shame! :-[

doodle