<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <title>Latest snippets tagged mysql propel symfony php</title>
  <link rel="alternate" href="http://snippets.prendreuncafe.com/snippets/tagged/mysql+propel+symfony+php/order_by/date"></link>
  <id>http://snippets.prendreuncafe.com/snippets/tagged/mysql+propel+symfony+php/order_by/date</id>
  <updated>2007-01-15T12:05:04Z</updated>
  <author>
    <name>Symfony</name>
    <author_email>noreply@symfony-project.com</author_email>
  </author>
<entry>
  <title>[Symfony] Traiter les OR sql avec Propel</title>
  <link href="http://snippets.prendreuncafe.com/snippet/40"></link>
  <updated>2007-01-15T12:05:04Z</updated>
  <id>40</id>
  <summary type="html">Voici comment gérer les &quot;ou&quot; SQL dans Propel :

[code]
$criteria = new Criteria();
$criteria-&gt;add(TotoPeer::NAME, 'Gérard Bouchard');
$criterion = $criteria-&gt;getNewCriterion (
  TotoPeer::ID, 5
)-&gt;addOr($criteria-&gt;getNewCriterion (
  TotoPeer::ID, 10
));
$criteria-&gt;addAnd($criterion);
TotoPeer::doSelect($criteria);
[/code]

Ceci donnera quelque chose comme :

[code]
SELECT 
  * 
FROM 
  toto 
WHERE 
  toto.NAME = 'Gérard Bouchard' 
  AND 
  (
    toto.ID = 5 
    OR 
    toto.ID = 10
  );
[/code]</summary>
</entry>
</feed>