Hi Maxime, PO fetches table rows through id fields, and it makes no sense to do distinct on id field, ids should be unique. Also you can't make count query through PO session. To add this functionality you should add a method in the query layer to transform your query to count query (modify select string, remove where string etc) and a method in the persistent session class that will use this.
Regards, Petar On Thu, Dec 30, 2010 at 8:11 AM, Maxime Thomas <[email protected]>wrote: > Hi Zetadev, > > A quick question for those using ezcPersistentObject and the standard > ezcPersistentSessionINstance::createFindQuery(). > > I'm a bit stuck with that code : > > <code> > $s = ezcPersistentSessionInstance::get(); > $q = $s->createFindQuery("className"); > ... > $s->find($q, 'className'); > </code> > > > How can I make distinct or count on "className" ? > Do I have to cheat and do something like this : > > <code> > $db = ezcDbInstance::get(); > $q = $db->createSelectQuery(); > $q->selectDistinct("id"); > $q->from("className"); > ... > $s->find($q, 'className'); > </code> > > Or does it have a proper way to be run ? > > Or do I have to make my query with the query layer only ? > > Thank you for any kind of answers. > > -- > Maxime > [email protected] | www.wascou.org | http://twitter.com/wascou >
