On 12/20/06, AD7six <[EMAIL PROTECTED]> wrote:
On Dec 20, 12:03 pm, Tijs Teulings <[EMAIL PROTECTED]> wrote:
> I might be daft but in these cases plain old SQL isn't all that bad is it...
>
> $posts = $this->Post->query("SELECT DISTINCT Post.title, Post.body FROM
> posts as Post
> LEFT JOIN posts_tags as pt ON Post.id = pt.post_id
> LEFT JOIN tags as Tag ON Tag.id = pt.tag_id
> WHERE Tag.id = '$id' AND Post.published < NOW()");
>
> I haven't tested the actual SQL but something like that should work like a
> charm and the result would be a Cake compatible array.
>
> SQL != evil :)
>
> Tijs
SQL certainly isn't evil :)
However if you use query you lose any afterFind, beforeFind stuff plus
no ability to modify the recursiveness of the results (because there
can be no recursive model fetching behavior if you use query).
Which makes an excellent case for beforeQuery and afterQuery OTOH if
you use a query it is assumed that you are #1 aware as to what you are
doing #2 doing it at your own risk.
Cheers
Tarique
--
=============================================================
PHP Applications for E-Biz: http://www.sanisoft.com
Coppermine Picture Gallery: http://coppermine.sf.net
=============================================================
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---