best way to limit records returned ny lazy loading


maybe this is a silly question but …

how do I best limit the records returnd by a lazy load

say I have 2 models


I want to use :

$events = $artist->Event

but only retrieve ids and names of events for instance

or just the events that are after a certain date

I want to do this to be able to set certain properties in the Artist model like Artist->futureEvents for instance with the help of a getter method

public function getFutureEvents() {

   ... some code to restrict Events retrieved by lazy loading ?

  $this->_futureEvents = $this->Event;//


is this a good approach, is it doable ?

thanks in advance

hi again,

after searching a bit it seems like this :

$this->metaData->relations['Event']->condition = '??.name = :name';

$this->metaData->relations['Event']->params = array(':name' => 'my event');

seems to work

is it a good approach ?

if so I have now to be able to reset the relations parameters if another lazy call was to be performed in the same application run

because this :

$this->metaData->relations['Event']->condition = '';

after a first :


does not seem to reset the conditions

I guess I have to reset the metaData …

maybe this is not the way to go ?

thanks in advance

Do not modify data in metaData. That will affect all your future queries.

in the upcoming 1.0.5 release, you will be able to supply parameters dynamically to lazy loading. For example:




That will affect all your future queries.

thats what I thought

so right now there is no way I can change the relations parameters for lazy loading ?

and also

any date for 1.0.5 ?


May 10, tentatively.

ah thanks

is there a usable version on subversion ?