« Return to Thread: Debugging/deciphering library methods

Re: Re: Debugging/deciphering library methods

by Ryan Boyd-3 :: Rate this Message:

Reply to Author | View in Thread



On 9/27/07, Trevor Johns <trevor@...> wrote:
On 2007-09-25 10:37:06 -0700, dmclark said:

>               <strong>Title: </strong> <?php echo $event->title->text ?> <br />
>               <strong>content: </strong> <?php echo $event->content ?> <br />
>               <strong>when: </strong> <?php echo $event->when['startTime'] ?> <br />

Hi dmclark,
I think I might see your problem. Try $event->content->text and
$event->when->startTime.

I know it can be confusing at times. Unfortunately __toString() isn't
implemented consistently throughout the client library, which would
mitigate the simpler cases. This is a known issue (ZF-1632), and
something I'd very much like to see improved for future releases.

Thanks Trevor.  There also another thread about this issue here:
http://groups.google.com/group/google-calendar-help-dataapi/browse_frm/thread/fd6c99e68ae7edb7/a52dffe82a1b4560?lnk=gst&q=umb.edu&rnum=1#a52dffe82a1b4560

Not sure that toString solves this issue entirely though.  It definitely works for things like atom:content (which is the confusing part here).  We had some other ideas that we were floating around, and I thought I'd see what people think about it.

Right now, the data model closely resembles the XML.  However, there are some XML elements used by GData services which only have a single attribute/child text node (or a single commonly-used attribute/child text node).  See the class that represents gCal:selected, gCal:color, gCal:timezone for instance.  Currently, to set one of these on an entry, the developer needs to actually create a new instance of the class and set the appropriate values.  It would be easier if the client could just pass the appropriate text for an entry.

For example:
Instead of:
$entry->color = $gdata->newColor('orange')
We'd have:
$entry->colorValue = 'orange';

Similar things could hold true for title and content (though they each have more than one bit of data which needs to be set):
$entry->titleValue = 'foo';  (would automatically create a Zend_Gdata_App_Extension_Title object with the appropriate child text node.

The same thing would be used for retrieving data (though the toString solution solves this for newer versions of PHP):
print $entry->colorValue would traverse the Zend_Gdata_Calendar_Extension_Color object and grab the value of $_value

Thoughts?

-Ryan

:
$event->contentValue, $event->

--
Trevor Johns
http://tjohns.net



 « Return to Thread: Debugging/deciphering library methods