function getEntities(Search $search = NULL, $offset = 0, $limit = -1)
{
$qb = $this->getManager()->createQueryBuilder();
$qb->select(self::ALIAS)->from($this->entityClassName, self::ALIAS);
if ($search !== NULL) {
if (get_class($search) !== $this->searchClassName) {
throw new \Exception("The search needs to be a '.{$this->searchClassName}.' instance.");
}
$this->processInterogation($search, $qb);
$this->processOrder($search, $qb);
}
if ($limit >= 0) {
$qb->setFirstResult($offset);
$qb->setMaxResults($limit);
}
return $qb->getQuery()->getResult();
}