this is my query:
public function getDetails($userid, $orderby, $sort){
$query = $this->_em->createQueryBuilder() ->select(\'u\'
You can't use placeholders for dinamical build of DQL query. You'll have to code it by your own:
$sortBy = in_array($sortBy, array(...)) ? $sortBy : 'id'; $sortDir = $sortDir == 'ASC' ? 'ASC' : 'DESC'; $this->em->createQueryBuilder() ... ->orderBy('u.' . $sortBy, $sortDir)