The answer to your first question is "maybe". It depends on how you set up
your lazy-loading. You can make it lazy-load the entire collection, lazy
load the individual entities, or both.

For your second question, check out my blog (shamelessly plugged, but it has
code samples):

http://www.virgentech.com/blog/2010/01/lazy-loading-and-data-mappers.html

<http://www.virgentech.com/blog/2010/01/lazy-loading-and-data-mappers.html>
--
Hector


On Thu, May 6, 2010 at 10:18 PM, Mon Zafra <[email protected]> wrote:

> Hi,
>
> Sorry for bumping a month-old thread, I'd just like to know more about this
> bit.
>
> Does this mean that the database isn't actually queried until you iterate
> over the ArticleCollection? Is there a code example for this that I could
> examine?
>
> Thanks,
>    -- Mon
>
>
>
> On Fri, Apr 16, 2010 at 1:41 AM, Hector Virgen <[email protected]> wrote:
>
>>
>> I would pass in the criteria as array('published' => true). The mapper
>> then maps that to "WHERE isPublished = 1".
>>
>> I don't support returning *n* articles in the mapper because my
>> lazy-loading iterator handles that for me:
>>
>> $articles = $mapper->fetchAll(array('published' => true));
>> assert($articles instanceof Default_Model_ArticleCollection); // true
>> assert($articles instanceof SeekableIterator); // true
>> $articles->seekTo(20);
>> $article = $articles->current();
>> assert($article instanceof Default_Model_Article); // true
>>
>>
>>

Reply via email to