From: Martin K. <Mar...@bl...> - 2003-06-10 15:19:58
|
"K. Ono" <on...@xo...> writes on Sun, 08 Jun 2003 04:42:35 +0200 (METDST): > > > Set a limit (or start and limit) by itself (no where clause). I > > didn't see > a way to achieve this, so I did fetch() this way. > > Yes, you can set it without the where part by creating an instance of > the CriteriaCompo class > that doesn't contain any child instance of the Criteria class. > > $criteria = new CriteriaCompo(); > $criteria->setLimit(10); > $criteria->setStart(5); > With the above code, either $criteria->renderWhere() or > $criteria->render() > will return an empty string. Ok, so we don't need a fetch() method like this. But I'd like to have a default sorting for the class. We could either let my extended constructor like it is (with sort ahnd sort order arguments) or remove them but retain the methods to set them explicitely. Or we could change the whole mechanism to a default Criteria object (again with the choices of constructor argument and/or method). Should Criteria move to class if ObjectHandler depends on it (though indirectly). > > I also wasn't sure if I could add multiple sort columns (with > > separate sort order). Or how to use multiple group by columns. I > > need some time to play with the class. > > You're right and this is not currently possible. You can only set > multiple sort columns. > $criteria->setSort('id, title'); BTW, you cannot change the sort order after changing it from the default. Masi PS: How can some general info for a class/file be added to the documtation. I know how it works in Doxygen and would like to add some lines of tipps and tricks for Object and Criteria. That is, if I find the time ;-) |