OphCoTherapyapplication_FileCollection::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

Esempio n. 1
0
 public function actionDeleteFileCollections()
 {
     $result = 1;
     foreach ($_POST['file_collections'] as $file_collection_id) {
         try {
             if ($collection = OphCoTherapyapplication_FileCollection::model()->findByPk($file_collection_id)) {
                 foreach ($collection->file_assignments as $file_assignment) {
                     if (!$collection->removeFileById($file_assignment->file_id)) {
                         $result = 0;
                     }
                 }
                 if (!$collection->delete()) {
                     $result = 0;
                 }
             }
         } catch (Exception $e) {
             Yii::log("couldn't remove file collection {$file_collection_id}: " . $e->getMessage(), 'error');
             $result = 0;
         }
     }
     echo $result;
 }
All Usage Examples Of OphCoTherapyapplication_FileCollection::model