|
@@ -39,6 +39,7 @@ class RESTController extends VoryxController
|
|
|
public function cgetAction(ParamFetcherInterface $paramFetcher)
|
|
|
{
|
|
|
$em = $this->getDoctrine()->getManager();
|
|
|
+ $disableTenancy = false;
|
|
|
$filters = !is_null($paramFetcher->get('filters')) ? $paramFetcher->get('filters') : array();
|
|
|
if (isset($filters['tenancyId'])) {
|
|
|
// tengo que buscar por tenencia.
|
|
@@ -46,6 +47,13 @@ class RESTController extends VoryxController
|
|
|
$tenancyService->setTenancy($filters['tenancyId']);
|
|
|
unset($filters['tenancyId']);
|
|
|
}
|
|
|
+ if (isset($filters['disableTenancy'])) {
|
|
|
+ $disableTenancy = true;
|
|
|
+ // tengo que buscar por tenencia.
|
|
|
+ $tenancyService = $this->container->get('base_tenancy.tenancy_service');
|
|
|
+ $tenancyService->disableFilter();
|
|
|
+ unset($filters['disableTenancy']);
|
|
|
+ }
|
|
|
if (isset($filters['qb-criteria'])) {
|
|
|
try {
|
|
|
|
|
@@ -76,6 +84,8 @@ class RESTController extends VoryxController
|
|
|
$repo = $em->getRepository($this->repository);
|
|
|
$entities = $repo->matching($criteria)->toArray();
|
|
|
|
|
|
+ if($disableTenancy) $tenancyService->enableFilter();
|
|
|
+
|
|
|
if ($entities) {
|
|
|
return $entities;
|
|
|
}
|
|
@@ -91,6 +101,8 @@ class RESTController extends VoryxController
|
|
|
$order_by = $paramFetcher->get('order_by');
|
|
|
$entities = $em->getRepository($this->repository)->findBy($filters, $order_by, $limit, $offset);
|
|
|
|
|
|
+ if($disableTenancy) $tenancyService->enableFilter();
|
|
|
+
|
|
|
if ($entities) {
|
|
|
return $entities;
|
|
|
}
|