We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

parameters in clauses orWhere/andWhere

how I can pass parameters in clauses orWhere / andWhere, with query builder??

something like this:

$builder->andWhere( "filed LIKE ?", $value)

Pass bind params to execute method call

$result = $this->modelsManager->createBuilder()
   ->where('xxx = 1')
   ->andWhere('username = :name:')
   ->exequte(array('name' => $value));


thanks but i wanna use the LIKE operator, what is the sintax for that

   ->andWhere('filed LIKE :name:')
   ->exequte(array('name' => $value));

use any sql you want, just place named parameters and then pass to exequte call array with keys as named parameters without : at start and end. So if you write

->where('xxx = :randomvar:')
->andWhere('filed LIKE :anotherrandomvar:')

then to exequte you pass it like this

->exequte(array('randomvar' => $value1, 'anotherrandomvar' => $value2));


thanks!! one more question, if i wanna use the IN clausule, what is the sintax for that