I'm using Apigility to create a rest application, where the back-end and front-end are pretty much independent applications.
Ok, on the Back-end I'm using 'zf-apigility-doctrine-query-provider'
to create queries depending on the parameters sent via url (i.e localhost?instancia=10
), but I need to process information using a MS SQL database stored function, something like this:
function createQuery(ResourceEvent $event, $entityClass, $parameters){
/* @var $queryBuilder \Doctrine\ORM\QueryBuilder */
$queryBuilder = parent::createQuery($event,$entityClass, $parameters);
if (!empty($parameters['instancia'])) {
$queryBuilder->andWhere($queryBuilder->expr()->eq('chapa.instancia', 'dbo.isItSpecial(:instancia)'))
->setParameter('instancia', $parameters['instancia']);
}
return $queryBuilder;
}
However it simply won't work, it won't accept the 'dbo.isItSpecial'
and seems like I can't access the ServiceLocator
, nor the EntityManager
or anything but the Querybuilder
.
I thought about creating a native query to get the result and the using it on the main query but seems like I can't create it.
Any ideas?