[ansel] gallery ordering issue
Chuck Hagenbuch
chuck at horde.org
Mon Apr 5 14:21:16 PDT 2004
Quoting "Heath S. Hendrickson" <heath at outerspaceconsultants.com>:
> 1) user requests Ansel page which in turn calls &getGalleryById($cid)
> [where $cid presumably = -1 for the top-level view]
We'll never be calling getGalleryById with a $cid of -1. -1 is the top of each
virtual tree in the DataTree system, yes, but getGalleryById is always called
for actual galleries, and we don't create a top-level gallery that holds all
the others for all users.
> 2) getGalleryById() calls _datatree->getObjectById()
> 3) _datatree->getObjectById() calls getName() in order to call getObject()
> 3a) getName() calls _loadById() if the object isn't already loaded
> in the nameMap
> 3b) _loadById() will attempt to load the indicated object and all of
> it's parents (if there are any)
> 3c) getName() returns the name associated with the $cid from 1).
> 4) getObject() then proceeds to call getId() in order to call
> getAttributes() or getData()
> 4a) getId() looks up the id from the _nameMap which was created in 3b)
> 5) getAttributes() or getData() actually do the SQL retrieval of the data...
This looks right.
> What's the difference between the $cid and the return of getId()?
Should be the same value.
> If they are the same value, then what is the purpose of calling getName()
> only to have to convert it back to an an id later via getId()... (the
> only reason that's apparent to me is to populate the nameMap and load
> the entire tree).
Right - and DataTree is designed around the tree and needs nameMap for some of
its internal operations.
Take a look at what I just committed; I'm not sure that it'll
streamline things
much, but it's a start. The _loadById() call is still necessary so that we can
call getName() to instantiate the category with the right name, etc.
Ways to load less data at a time is a potentially productive path to go down;
let's see where this goes.
-chuck
--
"Regard my poor demoralized mule!" - Juan Valdez
More information about the ansel
mailing list