ImportSource::model PHP Method

model() public static method

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

Usage Example

Exemplo n.º 1
0
 public function actionDeleteDataSources()
 {
     if (!empty($_POST['source'])) {
         foreach ($_POST['source'] as $source_id) {
             if (Institution::model()->find('source_id=?', array($source_id))) {
                 echo "0";
                 return;
             }
             if (Site::model()->find('source_id=?', array($source_id))) {
                 echo "0";
                 return;
             }
             if (Person::model()->find('source_id=?', array($source_id))) {
                 echo "0";
                 return;
             }
         }
         foreach ($_POST['source'] as $source_id) {
             if ($source = ImportSource::model()->findByPk($source_id)) {
                 if (!$source->delete()) {
                     throw new Exception("Unable to delete import source: " . print_r($source->getErrors(), true));
                 }
             }
         }
         Audit::add('admin-DataSource', 'delete');
     }
     echo "1";
 }
All Usage Examples Of ImportSource::model