tags:

views:

290

answers:

0

in doctrine you can create DQL in 2 ways:

QueryBuilder:

$query = $em->createQuery('SELECT u FROM MyProject\Model\User u WHERE u.id = ?1');

EntityManager::createQuery

$qb->add('select', 'u')
   ->add('from', 'User u')
   ->add('where', 'u.id = ?1')
   ->add('orderBy', 'u.name ASC');

i wonder what the difference is and which you should use?

thanks