public function setAttribute($key, $value)
    {
        if (array_key_exists($key, $this->getMediaFiles())) {
            if ($value) {
                $this->media_files[$key]
                    ->setUploadedFile($value, $key);
            }

            return $this;
        }

        return parent::setAttribute($key, $value);
    }
public function setAttribute($key, $value)
    {
        if (array_key_exists($key, $this->getMediaFiles())) {
            if ($value) {
                $this->media_files[$key]
                    ->setUploadedFile($value, $key);
            }

            return $this;
        }

        return parent::setAttribute($key, $value);
    }
public function setAttribute ( $ key , $ value ) { if ( array_key_exists ( $ key , $ this -> getMediaFiles ( ) ) ) { if ( $ value ) { $ this -> media_files [ $ key ] -> setUploadedFile ( $ value , $ key ) ; } return $ this ; } return parent :: setAttribute ( $ key , $ value ) ; }
Handle the dynamic setting of media items.

@param string $key
@param mixed  $value

@return $this
Handle the dynamic setting of media items .