Re: [symfony-users] propel. how to retrieve

2009-12-01 Thread g0d br
im sorry to hear that... but my next project i will start with doctrine for sure. Thanks all On Tue, Dec 1, 2009 at 12:23 PM, Daniel Lohse wrote: > This will get messy very fast. Imagine only 20 categories and for this > simple count, you'll already have 20 queries. Not good. :( > > Normally, yo

Re: [symfony-users] propel. how to retrieve

2009-12-01 Thread Daniel Lohse
This will get messy very fast. Imagine only 20 categories and for this simple count, you'll already have 20 queries. Not good. :( Normally, you'd do a count on the category_id column and group by the same category_id column. So simple in SQL/Doctrine but so hard in Propel. :( Daniel On 2009-1

Re: [symfony-users] propel. how to retrieve

2009-12-01 Thread Dheeraj Kumar Aggarwal
hi for the first part, use this . $c = new Criteria(); $c->addJoin(ProductPeer::CATEGORY_ID, CategoryPeer::ID); $c->setDistinct(); $categories = CategoryPeer::doSelect($c); now the $categories variable contains the categories that have at least one product On Tue, Dec 1, 2009 at 5:58 AM, G

Re: [symfony-users] propel. how to retrieve

2009-12-01 Thread Gareth McCumskey
First, you will always have a category with at least one product because you have set cascade on delete. For the second part, in your CategoryPeer class: public static function getProductCountPerCategory() { //Get all categories $category_obj_arr = self::doSelect(new Criteria()); //Get cou

[symfony-users] propel. how to retrieve

2009-12-01 Thread g0d br
Hi, I dont even know how to ask that but i want to show what i need. my schema.yml category: id: ~ title: { type: varchar(100), required: true, index: unique } product: id:~ category_id: { type: integer, foreignTable: category, foreignReference: id, onDelete: cascade } name: { type: va