Login | Register
My pages Projects Community openCollabNet

Discussions > dev > Re: [propel-dev] Criteria proposal

propel
Discussion topic

Back to topic list

Re: [propel-dev] Criteria proposal

Reply

Author tamcy <7am dot online at gmail dot com>
Full name tamcy <7am dot online at gmail dot com>
Date 2006-05-31 00:02:11 PDT
Message Hi devs,

PDO support and Criteria2 are what I'm looking for, so I am really
happy to see they're coming to Propel :). I have a concern about order
by clauses and I hope this is on the topic. "Order by" clauses are
mostly but not neccearily columns, e.g. "order by case when no='4'
then 1 when no='1' then 2 when no='2' then 3 end, col2" is possible
(and I just encounter real need to this).

It looks like current Criteria2 is still possible to do so by a, say,
CustomOrderByColumn class. But this class will then be a decendant of
QueryColumn, which doesn't "sound right" because a ColumnMap seems
"too much" for my CustomOrderByColumn class. Also there is no way for
me to add my own CustomOrderByColumn object to the Query class.

Just a thought of implementation, how about:
- There is a OrderBy(for instance) interface
- The OrderByColumn now implements OrderBy extends QueryColumn
- I can have my "class CustomOrderByColumn implements OrderBy"
(actually this CustomOrderByColumn is very general that may even make
it into Propel)
- Current addAscOrderBy and addDescOrderBy should be kept since they
are frequently used
- A new addOrderBy() function that can be used like this:
$query->addOrderBy(new CustomOrderByColumn('case when no='4' then 1
when no='1' then 2 when no='2' then 3 end, col2'));

Tamcy

On 5/31/06, Hans Lellelid <hans at velum dot net> wrote:
> Hi guys -
>
>
> Yeah, I think Criteria makes more sense as a WHERE-clause for the reason
> that Criteria can be nested/related logically. For example:
>
> $c = BookPeer::createCriteria();
> $c->add(new OrExpr(new EqualExpr(....), new GreaterExpr(....)));
>
> $c2 = AuthorPeer::createCriteria();
> $c2->add(new AndExpr(new EqualExpr(...), new InExpr(...)));
>
>
> $c->add($c2);
>
> So, from that example, you could see that if $c2 had
> setLimit()/setOffset​()/setHaving() defined, it would be "lost" when it
> was combined with the $c Criteria. So that was my original thinking
> with moving that to Query -- which is not an object that can be combined
> logically / nested. Hope that makes sense. Now, of course, it could
> just be a matter of choosing a better name for Criteria :)
>
>
> > Also, where does group by go? Does it even need to be handled by
> > Criteria? Are criteria *solely* for selecting data which will be used in
> > Propel-managed objects?
>
> That's also a good question. I don't know, although I think the system
> needs to be a little bit flexible. The reason is that we already use
> some of that flexibility -- for example, in the doCount() methods we
> create a query that doesn't actually hydrate propel result objects.
> That said, I'm not sure we need to support things that Propel probably
> doesn't need -- like aliasing for columns.
>
> Yeah, I think Propel 2.0 can definitely be PHP 5.1 only. I'm not sure
> about 1.3 ... I suppose if we release a 1.3 it can be 5.1 too. I think
> Gentoo considers it stable now, which can be a benchmark of sorts. On
> the other hand, I saw on some list today that CentOS still isn't
> shipping w/ PHP5 :)
>
> I may check in some more code tomorrow. I've completed the
> doUpdate/doDelete()/doInsert() BasePeer methods and have been making
> template changes to use new Criteria. There are a few rough edges
> still, but I think the system holds up fairly well.
>
> ... more to come. Appreciate the feedback & discussion.
>
> Hans
>
> --------------------​--------------------​--------------------​---------
> To unsubscribe, e-mail: dev-unsubscribe@prop​el.tigris.org
> For additional commands, e-mail: dev-help at propel dot tigris dot org
>
>

« Previous message in topic | 18 of 25 | Next message in topic »

Messages

Show all messages in topic

Criteria proposal hlellelid Hans Lellelid 2006-05-26 11:37:28 PDT
     Re: [propel-dev] Criteria proposal Cameron Brunner <cameron dot brunner at gmail dot com> Cameron Brunner <cameron dot brunner at gmail dot com> 2006-05-26 22:12:34 PDT
         Re: [propel-dev] Criteria proposal =?ISO-8859-1?Q?David_Z=FClke?= <dz at bitxtender dot com> =?ISO-8859-1?Q?David_Z=FClke?= <dz at bitxtender dot com> 2006-05-27 04:30:33 PDT
             Re: [propel-dev] Criteria proposal Cameron Brunner <cameron dot brunner at gmail dot com> Cameron Brunner <cameron dot brunner at gmail dot com> 2006-05-27 05:02:31 PDT
                 Re: [propel-dev] Criteria proposal =?ISO-8859-1?Q?David_Z=FClke?= <dz at bitxtender dot com> =?ISO-8859-1?Q?David_Z=FClke?= <dz at bitxtender dot com> 2006-05-27 08:17:09 PDT
                     Re: [propel-dev] Criteria proposal hlellelid Hans Lellelid 2006-05-27 09:43:15 PDT
     Re: [propel-dev] Criteria proposal Ants Aasma <ants dot aasma at gmail dot com> Ants Aasma <ants dot aasma at gmail dot com> 2006-05-27 12:47:55 PDT
         Re: [propel-dev] Criteria proposal hlellelid Hans Lellelid 2006-05-27 14:21:23 PDT
     Re: [propel-dev] Criteria proposal Alan Pinstein <apinstein at mac dot com> Alan Pinstein <apinstein at mac dot com> 2006-05-29 09:03:50 PDT
         Re: [propel-dev] Criteria proposal hlellelid Hans Lellelid 2006-05-29 11:51:30 PDT
         Re: [propel-dev] Criteria proposal hlellelid Hans Lellelid 2006-05-30 06:24:56 PDT
             Re: [propel-dev] Criteria proposal Alan Pinstein <apinstein at mac dot com> Alan Pinstein <apinstein at mac dot com> 2006-05-30 07:16:34 PDT
                 Re: [propel-dev] Criteria proposal hlellelid Hans Lellelid 2006-05-30 07:48:57 PDT
                     Re: [propel-dev] Criteria proposal Cameron Brunner <cameron dot brunner at gmail dot com> Cameron Brunner <cameron dot brunner at gmail dot com> 2006-05-30 17:09:25 PDT
                     Re: [propel-dev] Criteria proposal Alan Pinstein <apinstein at mac dot com> Alan Pinstein <apinstein at mac dot com> 2006-05-30 17:34:24 PDT
                         Re: [propel-dev] Criteria proposal Cameron Brunner <cameron dot brunner at gmail dot com> Cameron Brunner <cameron dot brunner at gmail dot com> 2006-05-30 17:46:52 PDT
                         Re: [propel-dev] Criteria proposal hlellelid Hans Lellelid 2006-05-30 18:43:06 PDT
                             Re: [propel-dev] Criteria proposal tamcy <7am dot online at gmail dot com> tamcy <7am dot online at gmail dot com> 2006-05-31 00:02:11 PDT
                                 Re: [propel-dev] Criteria proposal hlellelid Hans Lellelid 2006-05-31 04:36:50 PDT
                             Re: [propel-dev] Criteria proposal Ants Aasma <ants dot aasma at gmail dot com> Ants Aasma <ants dot aasma at gmail dot com> 2006-05-31 04:06:51 PDT
                                 Re: [propel-dev] Criteria proposal Alan Pinstein <apinstein at mac dot com> Alan Pinstein <apinstein at mac dot com> 2006-05-31 05:12:11 PDT
                                 Re: [propel-dev] Criteria proposal hlellelid Hans Lellelid 2006-05-31 05:49:59 PDT
                                     Re: [propel-dev] Criteria proposal Alan Pinstein <apinstein at mac dot com> Alan Pinstein <apinstein at mac dot com> 2006-05-31 06:05:32 PDT
                                         Re: [propel-dev] Criteria proposal hlellelid Hans Lellelid 2006-05-31 06:21:31 PDT
                                         Re: [propel-dev] Criteria proposal Ants Aasma <ants dot aasma at gmail dot com> Ants Aasma <ants dot aasma at gmail dot com> 2006-05-31 09:09:12 PDT
Messages per page: