zendframework / zf1

This project reached its end-of-life on 2016-09-28. Contains conversion of ZF1 subversion repo to git, from version 15234 forward, and only containing master and release-1.12 branches and 1.12 tags.
https://framework.zend.com/blog/2016-06-28-zf1-eol.html
BSD 3-Clause "New" or "Revised" License
357 stars 801 forks source link

delete tag in picasa photo error #47

Open zfbot opened 11 years ago

zfbot commented 11 years ago

Jira Information

Original Issue:ZF-12504
Issue Type:Bug
Reporter:Rodolfo Van Kurczyn
Created:01/09/13
Assignee:froschdesign
Components:Zend_Gdata

Description

When use the function for delete tag in picasa photo

deleteTag($client, $user, $album, $photo, $tagContent);

this happens:

Fatal error:
Uncaught exception 'Zend_Gdata_App_InvalidArgumentException' with message 'You must specify an URI to which to post.' in Zend/Gdata/App.php:623

Stack trace:

#0 Zend/Gdata.php(219): Zend_Gdata_App->performHttpRequest('DELETE', NULL, Array, '', NULL, NULL)
#1 Zend/Gdata/App.php(957): Zend_Gdata->performHttpRequest('DELETE', NULL, Array, '', NULL, NULL)
#2 Zend/Gdata/Photos.php(572): Zend_Gdata_App->delete(NULL)
#3 public_html/autenticate_zend.php(130): Zend_Gdata_Photos->deleteTagEntry(NULL, false)
#4 public_html/autenticate_zend.php(83): deleteTag(Object(Zend_Gdata_HttpClient), 'google account', 'password', '576764976912403...', 'hola mundo')
#5 {main} thrown in Zend/Gdata/App.php on line 623
zfbot commented 11 years ago

(Originally posted by: froschdesign on 01/10/13)

{quote}``` This is not a ZF method!

{quote}``` This is the problem: You need the first parameter for {{Zend_Gdata_Photos::deleteTagEntry()}}.

{quote}``` Here is an unit test for this method call:

public function testPreparingRequestWithoutData()
{
    $this->assertEquals(
        array(
             'method'  => 'POST',
             'url'     => null,
             'data'    => null,
             'headers' => array(
                 'x-http-method-override' => 'DELETE',
             ),
             'contentType' => 'application/atom+xml',
        ),
        $this->service->prepareRequest('DELETE', null, array(), '', null, null)
    );
}

Tests passed

zfbot commented 11 years ago

(Originally posted by: Rodolfo Van Kurczyn on 01/11/13)

in the directory Zend/demos/Zend/Gdata/Photos.php

we have the following two functions

function addTag($client, $user, $album, $photo, $tag) { $photos = new Zend_Gdata_Photos($client);

$entry = new Zend_Gdata_Photos_TagEntry();
$entry->setTitle($photos->newTitle($tag));

$photoQuery = new Zend_Gdata_Photos_PhotoQuery;
$photoQuery->setUser($user);
$photoQuery->setAlbumId($album);
$photoQuery->setPhotoId($photo);
$photoQuery->setType('entry');

$photoEntry = $photos->getPhotoEntry($photoQuery);

$result = $photos->insertTagEntry($entry, $photoEntry);
if ($result) {
    outputPhotoFeed($client, $user, $album, $photo);
} else {
    echo "There was an issue with the tag creation.";
}

}

function deleteTag($client, $user, $albumId, $photoId, $tagContent) { $photos = new Zend_Gdata_Photos($client);

$photoQuery = new Zend_Gdata_Photos_PhotoQuery;
$photoQuery->setUser($user);
$photoQuery->setAlbumId($albumId);
$photoQuery->setPhotoId($photoId);
$photoQuery->setKind("tag");
$query = $photoQuery->getQueryUrl();    

$photoFeed = $photos->getPhotoFeed($query);

foreach ($photoFeed as $entry) {
    if ($entry instanceof Zend_Gdata_Photos_TagEntry) {
        if ($entry->getContent() == $tagContent) {
            $tagEntry = $entry;
        }
    }
}

$photos->deleteTagEntry($tagEntry, false);

outputPhotoFeed($client, $user, $albumId, $photoId);

}

I probe the first function successfully. The second function fail.

zfbot commented 11 years ago

This issue was ported from the ZF2 Jira Issue Tracker at http://framework.zend.com/issues/browse/ZF-12504

Known GitHub users mentioned in the original message or comment: @froschdesign