Using virtual fields in Doctrine_Query

Posted by James Maroney on Stack Overflow See other posts from Stack Overflow or by James Maroney
Published on 2010-05-22T17:03:39Z Indexed on 2010/05/22 17:10 UTC
Read the original article Hit count: 227

Filed under:
|
|
|

Is there a way to insert logic based on virtual fields into a Doctrine_Query?

I have defined a virtual field in my model, "getStatus()" which I would ultimately like to utilize in a Where clause in my Doctrine_Query.

...
->AndWhere('x.status = ?',$status);

"status", however, is not a column in the table it is instead computed by business logic in the model.

Filtering the Collection after executing the query works in some situations, but not when a Doctrine_Pager is thrown in the mix, as it computes it's offsets and such before you have access to the Collection.

Am I best off ditching Doctrine_Pager and rebuilding that functionality after modifying the Doctrine_Collection?

© Stack Overflow or respective owner

Related posts about php

Related posts about symfony