How to write complex queries using Propel

This is a monster subject, and I spent a long time scratching my head over a few things yesterday, until I came across this site:

It’s developed by a Symfony user, and allows you to type in sql statements using nested braces for prioritising. The form will then return a nicely formatted block of Propel code.

It’s not perfect, and it doesn’t cover everything just yet, but it’s great for getting some ideas about the structure and how to use various criteria – it’s also spot on if you are trying to learn Propel and already know how to structure SQL statements.

Discuss this tool and/or contribute on the Symfony Forum

Using a combination of tools like this, and taking a look at the generated files in lib/model/om should give you a good push, and a bit of a shortcut to more complex queries than you may be used to – rather than having to trawl the Propel documentation.

6 Comments so far

  1. Josh on April 28th, 2008

    Actually while learning criteria and propel, I found it easier to learn how to do it before using the propel criteria builder. 🙂

  2. Russ on April 28th, 2008

    One thing I still haven’t done is have a good look through the Propel docs… Suppose I should get round to that at some point!

  3. halfer on August 5th, 2008

    Glad you found it useful, Russ! I am the author of this tool.

    I haven’t worked on it in ages, and don’t really have the time at present. Should you or any of your readers want a challenge, it needs join support… source available for anyone who wants it 😉

  4. Russ on August 5th, 2008

    Maybe I’ll take that challenge one day…

    Is it PHP based?

    Maybe you could get it set up on SVN or something, possibly even as a Sourceforge project? Hmm…

  5. Lukkibessoni on August 20th, 2008

    I love google and Yahoo!

  6. bkuberek on August 19th, 2010

    @halfer: can you add it to Github? I’ll definitely fork it and contribute patches once in a while.

Leave a reply