OphTrOperationbooking_Operation_EROD_Rule::model PHP Method

model() public static method

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : the
return the static model class
    public static function model($className = __CLASS__)
    {
        return parent::model($className);
    }

Usage Example

Example #1
0
 public function actionDeleteERODRules()
 {
     if (!empty($_POST['erod'])) {
         $transaction = Yii::app()->db->beginTransaction();
         try {
             foreach ($_POST['erod'] as $erod_id) {
                 if ($_erod = OphTrOperationbooking_Operation_EROD_Rule::model()->findByPk($erod_id)) {
                     foreach ($_erod->items as $item) {
                         if (!$item->delete()) {
                             throw new Exception('Unable to delete rule item: ' . print_r($item->getErrors(), true));
                         }
                     }
                     if (!$_erod->delete()) {
                         throw new Exception('Unable to delete erod rule: ' . print_r($_erod->getErrors(), true));
                     }
                 } else {
                     throw new Exception('EROD Rule not found for id ' . $erod_id);
                 }
             }
             Audit::add('admin', 'delete', null, null, array('module' => 'OphTrOperationbooking', 'model' => 'OphTrOperationbooking_Operation_EROD_Rule'));
             $transaction->commit();
         } catch (Exception $e) {
             $transaction->rollback();
             echo $e->getMessage();
             Yii::app()->end();
         }
     }
     echo '1';
 }
All Usage Examples Of OphTrOperationbooking_Operation_EROD_Rule::model