예제 #1
0
 public function createComment($photo)
 {
     $client = $this->photos;
     $comment = new Photos\CommentEntry();
     $comment->setTitle($client->newTitle("test comment"));
     $comment->setContent($client->newContent("test comment"));
     $comment->setCategory(array($client->newCategory('http://schemas.google.com/photos/2007#comment', 'http://schemas.google.com/g/2005#kind')));
     $newComment = $client->insertCommentEntry($comment, $photo);
     $this->assertEquals($comment->getContent(), $newComment->getContent());
     $this->assertEquals($newComment->getContent(), $client->getCommentEntry($newComment->getLink('self')->href)->getContent());
     return $newComment;
 }
예제 #2
0
파일: Photos.php 프로젝트: alab1001101/zf2
 /**
  * Delete a CommentEntry.
  *
  * @param \Zend\GData\Photos\CommentEntry $comment The comment 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 deleteCommentEntry($comment, $catch)
 {
     if ($catch) {
         try {
             $this->delete($comment);
         } catch (App\HttpException $e) {
             if ($e->getResponse()->getStatus() === 409) {
                 $entry = new CommentEntry($e->getResponse()->getBody());
                 $this->delete($entry->getLink('edit')->href);
             } else {
                 throw $e;
             }
         }
     } else {
         $this->delete($comment);
     }
 }