Skip to content

Instantly share code, notes, and snippets.

@fzaninotto
Created December 11, 2009 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fzaninotto/254133 to your computer and use it in GitHub Desktop.
Save fzaninotto/254133 to your computer and use it in GitHub Desktop.
<?php
// syntax 1: condition/combine
$books = PropelQuery::from('Book')
->condition('cond1', 'Book.Title = ?', 'War And Peace') // create a condition named 'cond1'
->condition('cond2', 'Book.Title LIKE ?', 'War%') // create a condition named 'cond2'
->combine(array('cond1', 'cond2'), 'or', 'cond12') // create a condition named 'cond12' from 'cond1' and 'cond2'
->condition('cond3', 'Book.PublishedAt <= ?', $end) // create a condition named 'cond3'
->condition('cond4', 'Book.PublishedAt >= ?', $begin) // create a condition named 'cond4'
->combine(array('cond3', 'cond4'), 'and', 'cond34') // create a condition named 'cond34' from 'cond3' and 'cond4'
->where(array('cond12', 'cond34'), 'and') // combine the two conditions in a where
->find();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment