Пример #1
0
 public function createTag($photo)
 {
     $client = $this->photos;
     $tag = new Photos\TagEntry();
     $tag->setTitle($client->newTitle("test tag"));
     $tag->setContent($client->newContent("test tag"));
     $tag->setCategory(array($client->newCategory('http://schemas.google.com/photos/2007#tag', 'http://schemas.google.com/g/2005#kind')));
     $newTag = $client->insertTagEntry($tag, $photo);
     $this->assertEquals($tag->getTitle(), $newTag->getTitle());
     $this->assertEquals($newTag->getTitle(), $client->getTagEntry($newTag->getLink('self')->href)->getTitle());
     return $newTag;
 }
Пример #2
0
 /**
  * Delete a TagEntry.
  *
  * @param \Zend\GData\Photos\TagEntry $tag The tag entry to
  *          delete.
  * @param boolean $catch Whether to catch an exception when
  *            modified and re-delete or throw
  * @return void.
  * @throws \Zend\GData\App\Exception
  * @throws \Zend\GData\App\HttpException
  */
 public function deleteTagEntry($tag, $catch)
 {
     if ($catch) {
         try {
             $this->delete($tag);
         } catch (App\HttpException $e) {
             if ($e->getResponse()->getStatus() === 409) {
                 $entry = new TagEntry($e->getResponse()->getBody());
                 $this->delete($entry->getLink('edit')->href);
             } else {
                 throw $e;
             }
         }
     } else {
         $this->delete($tag);
     }
 }