/** * @return QueryBuilder */ private function createQueryBuilder() { /** @var \Doctrine\ORM\EntityRepository $repository */ $repository = $this->em->getRepository($this->table->getEntity()); $qb = $repository->createQueryBuilder($this->table->getPrefix()); foreach ($this->table->getColumns() as $column) { $column->__set('container', $this->table->getContainer()); /** @var EntityColumn $column */ if (get_class($column) === 'Voelkel\\DataTablesBundle\\Table\\Column\\EntityColumn') { $this->joinColumn($qb, $column); } if ($column instanceof EntitiesColumn) { $this->joinColumn($qb, $column); } if ($column instanceof EntitiesScalarColumn) { $this->joinColumn($qb, $column); } } $callback = $this->table->getConditionCallback(); if (null !== $callback) { call_user_func($callback, $qb); } return $qb; }