示例#1
0
 private function refresh($identifier, $fields)
 {
     $model = StorageEffect::find()->where(['identifier' => $identifier])->one();
     if ($model) {
         $model->setAttributes($fields, false);
         $model->update(false);
     } else {
         $this->getImporter()->addLog('filters', 'effect "' . $identifier . '" added');
         $insert = new StorageEffect();
         $insert->identifier = $identifier;
         $insert->setAttributes($fields, false);
         $insert->insert(false);
     }
 }
示例#2
0
文件: Filter.php 项目: efueger/luya
 private function resolveEffect($effectIdentifier)
 {
     $model = \admin\models\StorageEffect::find()->where(['identifier' => $effectIdentifier])->asArray()->one();
     if ($model) {
         return $model;
     }
     throw new \Exception("the provieded effect '{$effectIdentifier}' identifier does not exists in database.");
 }
示例#3
0
 public function getEffect()
 {
     return $this->hasOne(\admin\models\StorageEffect::className(), ['id' => 'effect_id']);
 }
示例#4
0
 /**
  * Find the effect model based on the effect identifier. If the effect could not found an exception will
  * be thrown.
  *
  * @param string $effectIdentifier The name of effect, used EFFECT prefixed constants like
  *                                 + EFFECT_RESIZE
  *                                 + EFFECT_THUMBNAIL
  *                                 + EFFECT_CROP
  *
  * @return array Contain an array with the effect properties.
  *
  * @throws Exception
  */
 public function findEffect($effectIdentifier)
 {
     // find effect model based on the effectIdentifier
     $model = StorageEffect::find()->where(['identifier' => $effectIdentifier])->asArray()->one();
     // if the effect model could not found, throw Exception.
     if (!$model) {
         throw new Exception("The requested effect '{$effectIdentifier}' does not exist.");
     }
     // array
     return $model;
 }