Exemplo n.º 1
0
use romkaChev\yandexFotki\models\AlbumPhotosCollection;
use romkaChev\yandexFotki\models\AlbumsCollection;
use romkaChev\yandexFotki\models\Author;
use romkaChev\yandexFotki\models\Image;
use romkaChev\yandexFotki\models\options\album\CreateAlbumOptions;
use romkaChev\yandexFotki\models\options\album\DeleteAlbumOptions;
use romkaChev\yandexFotki\models\options\album\GetAlbumPhotosOptions;
use romkaChev\yandexFotki\models\options\album\GetAlbumsOptions;
use romkaChev\yandexFotki\models\options\album\UpdateAlbumOptions;
use romkaChev\yandexFotki\models\options\photo\CreatePhotoOptions;
use romkaChev\yandexFotki\models\options\photo\DeletePhotoOptions;
use romkaChev\yandexFotki\models\options\photo\UpdatePhotoOptions;
use romkaChev\yandexFotki\models\options\tag\DeleteTagOptions;
use romkaChev\yandexFotki\models\options\tag\GetTagPhotosOptions;
use romkaChev\yandexFotki\models\options\tag\UpdateTagOptions;
use romkaChev\yandexFotki\models\Photo;
use romkaChev\yandexFotki\models\Point;
use romkaChev\yandexFotki\models\Tag;
use romkaChev\yandexFotki\models\TagPhotosCollection;
use romkaChev\yandexFotki\validators\AddressBindingValidator;
use romkaChev\yandexFotki\validators\AlbumValidator;
use romkaChev\yandexFotki\validators\AuthorValidator;
use romkaChev\yandexFotki\validators\ImageValidator;
use romkaChev\yandexFotki\validators\PhotoValidator;
use romkaChev\yandexFotki\validators\PointValidator;
use romkaChev\yandexFotki\validators\TagValidator;
use romkaChev\yandexFotki\YandexFotki;
use yii\httpclient\Client;
use yii\i18n\Formatter;
return ['id' => 'testApp', 'basePath' => __DIR__, 'vendorPath' => __DIR__ . '/../../../vendor', 'aliases' => ['@web' => '/', '@webroot' => __DIR__ . '/../runtime', '@vendor' => __DIR__ . '/../../../vendor'], 'components' => ['yandexFotki' => ['class' => YandexFotki::className(), 'apiBaseUrl' => 'http://api-fotki.yandex.ru/api', 'serviceBaseUrl' => 'http://fotki.yandex.ru', 'login' => null, 'oauthToken' => null, 'apiHttpClient' => Client::className(), 'serviceHttpClient' => Client::className(), 'albums' => AlbumComponent::className(), 'photos' => PhotoComponent::className(), 'tags' => TagComponent::className(), 'formatter' => Formatter::className(), 'factory' => ['class' => Factory::className(), 'addressBindingModel' => AddressBinding::className(), 'albumModel' => Album::className(), 'albumsCollectionModel' => AlbumsCollection::className(), 'albumPhotosCollectionModel' => AlbumPhotosCollection::className(), 'authorModel' => Author::className(), 'photoModel' => Photo::className(), 'tagModel' => Tag::className(), 'tagPhotosCollectionModel' => TagPhotosCollection::className(), 'pointModel' => Point::className(), 'imageModel' => Image::className(), 'getAlbumsOptions' => GetAlbumsOptions::className(), 'getAlbumPhotosOptions' => GetAlbumPhotosOptions::className(), 'createAlbumOptions' => CreateAlbumOptions::className(), 'updateAlbumOptions' => UpdateAlbumOptions::className(), 'deleteAlbumOptions' => DeleteAlbumOptions::className(), 'createPhotoOptions' => CreatePhotoOptions::className(), 'updatePhotoOptions' => UpdatePhotoOptions::className(), 'deletePhotoOptions' => DeletePhotoOptions::className(), 'getTagPhotosOptions' => GetTagPhotosOptions::className(), 'updateTagOptions' => UpdateTagOptions::className(), 'deleteTagOptions' => DeleteTagOptions::className(), 'addressBindingValidator' => AddressBindingValidator::className(), 'albumValidator' => AlbumValidator::className(), 'authorValidator' => AuthorValidator::className(), 'pointValidator' => PointValidator::className(), 'photoValidator' => PhotoValidator::className(), 'imageValidator' => ImageValidator::className(), 'tagValidator' => TagValidator::className()]]]];
 /**
  * @inheritdoc
  */
 public function update(UpdatePhotoOptions $options)
 {
     if (!$options->validate()) {
         throw new InvalidParamException(VarDumper::dumpAsString($options->getErrors()));
     }
     $httpClient = $this->yandexFotki->getApiHttpClient();
     $request = $httpClient->put("photo/{$options->id}", $options->toArray());
     $response = $request->send();
     $photo = $this->yandexFotki->getFactory()->getPhotoModel();
     $photo->loadWithData($response->getData(), true);
     return $photo;
 }
Exemplo n.º 3
0
 /**
  * @return UpdatePhotoOptions
  */
 public function getUpdatePhotoOptions()
 {
     $this->preProcessConfigurableItem('updatePhotoOptions', UpdatePhotoOptions::className());
     return clone $this->updatePhotoOptions;
 }