Doctrine: how to create a query using "LIKE REPLACE" ?
        Posted  
        
            by user248959
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user248959
        
        
        
        Published on 2010-06-01T13:29:32Z
        Indexed on 
            2010/06/01
            13:43 UTC
        
        
        Read the original article
        Hit count: 229
        
Hi,
this SQL clause is working OK:
SELECT * FROM `sf_guard_user` WHERE nombre_apellidos LIKE REPLACE('Mar Sanz',' ','%')
Now I'm trying to write this query for Doctrine. I have tried this:
$query->andWhere(sprintf('%s.%s LIKE REPLACE (?," ","%")',
                         $query->getRootAlias(), $fieldName),
                 'Mar Sanz'));
but I get this error:
Warning: sprintf() [function.sprintf]: Too few arguments
Any idea?
Regards
Javi
© Stack Overflow or respective owner