Zend_Service_Delicious and sorting

View: New views
2 Messages — Rating Filter:   Alert me  

Zend_Service_Delicious and sorting

by lists-101 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I have been wanting to sort the results from PostList::getAll() by the
title of the post, but since I cannot access the interal $_posts array
(since it's protected and does not have a get method), I cannot call
uasort().  Zend_Service_Delicious implements ArrayAccess, but only
Iterator (not ArrayIterator) so I cannot call ArrayIterator::uasort() on
it (in fact, this crashes PHP).

Has anyone else come across this problem or know a _clean_ way to solve
it?  I would rather not have to resort to some nasty hack...

Thanks,
Logan

Re: Zend_Service_Delicious and sorting

by jkendall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I second this request.  It would be very helpful to have a convenience method that would allow for sorting bookmarks, especially sorting bookmarks alphabetically.  I know that the delicious api doesn't provide this, but I don't see why the framework couldn't.

In the meantime, I have resorted to a hack, although I don't know how nasty it is.  I only have a few bookmarks that I'm displaying on a "Links" page, so I took the Zend_Service_Delicious_PostList object, created an associative array ($key => getTitle(), $value = getUrl()), and then ksorted the array.  With as few links as I'm displaying, that hack works perfectly and it's not too expensive.

Close enough for government work, but I'd prefer to sort the object.

lists-101 wrote:
Hello,

I have been wanting to sort the results from PostList::getAll() by the
title of the post, but since I cannot access the interal $_posts array
(since it's protected and does not have a get method), I cannot call
uasort().  Zend_Service_Delicious implements ArrayAccess, but only
Iterator (not ArrayIterator) so I cannot call ArrayIterator::uasort() on
it (in fact, this crashes PHP).

Has anyone else come across this problem or know a _clean_ way to solve
it?  I would rather not have to resort to some nasty hack...

Thanks,
Logan