What does "= :" mean in SQL or DQL?
Thanks!
That is a reference to parameter binding in DQL.
Note that numeric placeholders start with a ? followed by a number while the named placeholders start with a : followed by a string.
you must then set your parameter with a ->setParameter()
method.
$qb->select('u')
->from('User', 'u')
->where('u.id = :identifier')
->orderBy('u.name', 'ASC')
->setParameter('identifier', 100); // Sets :identifier to 100, and thus we will fetch a user with u.id = 100
This is good practice when using Doctrine because it is much more secure and prevent SQL Injection.