示例#1
0
 /**
  * Update meta data for current media.
  *
  * @param $meta_name
  * @param $meta_value
  *
  * @return bool
  */
 public function upMeta($meta_name, $meta_value)
 {
     /* @var $model \common\models\MediaMeta */
     $model = MediaMeta::find()->andWhere(['meta_name' => $meta_name])->andWhere(['media_id' => $this->id])->one();
     if (is_array($meta_value) || is_object($meta_value)) {
         $meta_value = Json::encode($meta_value);
     }
     $model->meta_value = $meta_value;
     return $model->save();
 }
示例#2
0
 /**
  * Update meta data for current media.
  *
  * @param string $name
  * @param string|array $value
  * @return bool
  */
 public function upMeta($name, $value)
 {
     /* @var $model \common\models\MediaMeta */
     $model = MediaMeta::findOne(['name' => $name, 'media_id' => $this->id]);
     if (is_array($value) || is_object($value)) {
         $value = Json::encode($value);
     }
     $model->value = $value;
     return $model->save();
 }