views:

119

answers:

1
WHERE column = value    ->add(column, value);
WHERE column <> value   ->add(column, value, Criteria::NOT_EQUAL);
Other Comparison Operators  
> , <   Criteria::GREATER_THAN, Criteria::LESS_THAN
>=, <=  Criteria::GREATER_EQUAL, Criteria::LESS_EQUAL
IS NULL, IS NOT NULL    Criteria::ISNULL, Criteria::ISNOTNULL
LIKE, ILIKE     Criteria::LIKE, Criteria::ILIKE
IN, NOT IN  Criteria::IN, Criteria::NOT_IN
Other SQL Keywords  
ORDER BY column ASC     ->addAscendingOrderByColumn(column);
ORDER BY column DESC    ->addDescendingOrderByColumn(column);
LIMIT limit     ->setLimit(limit)
OFFSET offset   ->setOffset(offset)
FROM table1, table2 WHERE table1.col1 = table2.col2     ->addJoin(col1, col2)
FROM table1 LEFT JOIN table2 ON table1.col1 = table2.col2   ->addJoin(col1, col2, Criteria::LEFT_JOIN)
FROM table1 RIGHT JOIN table2 ON table1.col1 = table2.col2  ->addJoin(col1, col2, Criteria::RIGHT_JOIN)

The above are all basic operations,what's the equivalent for fulltext search?

+1  A: 

The Doctrine documentation about Searching describes this pretty well.

Wrap up:

  • You have to add the behavior Searchable to your model definition and configure which fields should be indexed.
  • You might have to set up some other stuff that is explained in the documentation.
  • You can perform a search with search, e.g.:

    $newsItemTable = Doctrine_Core::getTable('NewsItem');
    $results = $newsItemTable->search('test');
    
Felix Kling