Skip to content
damiencorpataux edited this page Apr 25, 2012 · 9 revisions

Welcome to RestQL.

Why do

$books = BookQuery::create()
  ->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();

Propel example.

When you can

{
  SELECT: '*',
  FROM: 'book',
  WHERE: {
    OR: [
      title: 'War and Peace' },
      title: { 'LIKE:War%' }}
    ],
    AND: [
      published_at: { '>=:begin' }},
      published_at: { '<=:end' }}
    ]
}



Contents

Wiki guidelines

  • Markup is Textile

Clone this wiki locally