CDbException код ошибки несостоявшися sql-выражений

Здраствуйте, столкнулся с такой непонятной проблемой




      try{

        $form->delete();

      }catch( CDbException $ex){

        $message = $ex->getMessage();

        $code = $ex->getCode();

        if ( $code == 1451 && strstr($message, GoodTypes::FK_CATEGORY. ) )

          $message = "Can't delete type. It using in categorys";


      }



в переменной


$message

у меня следующее сообщение:

[acronym=‘1’]CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1451 Cannot delete or update a parent row: a foreign key constraint fails (honey.good_categorys, CONSTRAINT good_categorys_fk FOREIGN KEY (type_id) REFERENCES good_types (id))[/acronym]