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 Alan Pinstein <apinstein at mac dot com>
Full name Alan Pinstein <apinstein at mac dot com>
Date 2006-05-31 05:12:11 PDT
Message What the heck is a fluent interface? I have never heard of such a
thing... Have you got a link? Syntactically, this isn't even valid,
since FIRST_NAME is a class constant.

> $c->add(new EqualExpr(AuthorPeer​::FIRST_NAME()->l​ength(), 4));

Thanks,
Alan

On May 31, 2006, at 7:06 AM, Ants Aasma wrote:

> Hi,
>
> I looked at the examples you provided. The SqlExpr class seems a bit
> evil to me, as it leaks the database independence abstraction. I don't
> think it should be completely eliminated, but I do think its use
> should be heavily discouraged. Propel should provide a way to abstract
> the more frequently used expressions and provide a way to build plug
> in custom expressions so that the database dependent code goes into a
> well defined place. This will probably bring up the need for the
> criteria interface to be a bit more datatype aware.
>
> So the example
> $c = AuthorPeer::getCriteria();
> $c->add(new SqlExpr("char_length(name) = 4"));
>
> could be something like:
> $c->add(new EqualExpr(StringFiel​d::LengthExpr
> (AuthorPeer::FIRST_NAME), 4));
>
> or:
> $c->add(new EqualExpr(AuthorPeer​::FIRST_NAME()->l​ength(), 4));
>
> or going the fluent API way:
> $c->add(AuthorPe​er::FIRST_NAME()-​>length()->equals​(4));
>
> Even with the fluent API, the Criteria design can remain basically the
> same, only adding the convenience factory methods.
>
> By using this kind of SQL abstraction we could easily add commonly
> used abstract datatypes, such as timeperiod or money, and maybe even
> transparently support the Embedded Value (
> http://www.martinfow​ler.com/eaaCatalog/e​mbeddedValue.html ) pattern.
> This would shift propel a bit into the Data Mapper territory, but
> would make it a lot more suitable as a basis for a cleanly factored
> Domain Model.
>
> I still have to think a bit, how could we fit subqueries into the
> Criteria picture. It would be really sweet, if we could get something
> like this working:
> $c = HotelroomPeer::creat​eCriteria();
> $c->add( HotelroomPeer::RESER​VATIONS()->notAny​(
> ResevationPeer::TIME​PERIOD()->interse​cts( $conference->getTimeperiod()
> ) ) );
> $freeRooms = HotelroomPeer::doSelect( $c );
>
> The best part about the fluent interface would be that if we document
> everything appropriately IDE's will autocomplete all of this.
>
> Ants Aasma
>
> PS: Don't think that I'm ignoring you if I don't reply swiftly - I'm
> just having connectivity problems. The germans seem to have
> ridiculously expensive Wifi access. 30mins of wifi in my hotel costs
> the same as two beers from the minibar. Fortunately bundesdruckerei
> has hooked me up with free wiki at the conference center.
>
> --------------------​--------------------​--------------------​---------
> 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 | 21 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: