Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doctrine ODM - like operator syntax

how would i go about simulating the like operator from SQL in doctrine odm?

use case: i want to find a Theme that has somewhere in the field caption string in a variable $search.

How would the query look like?

thanks for all answers

like image 828
bazo Avatar asked Dec 21 '11 12:12

bazo


1 Answers

use MongoRegex

$qb->field($field)->equals(new \MongoRegex('/.*paliw.*/i'));

source

But i recomed use separate search engine (sphinx, Solr)

like image 174
TROODON Avatar answered Oct 22 '22 01:10

TROODON