Symfony - Voter dependancy conflict

108 Views Asked by At

I'm having an issue that I've been banging my head on the wall since the last 3 days (and google/stackoverflow research didn't give much result).

I'm currently maintaining an application developed by another developer (the original developer left). The application is in Symfony 2.6. Within it, there's a logic that handle de access through the concept of Voter. The application logic goes as is: The URL contain the customer(application) name. For instance, let's name our customer TEST. The url would be: myapplication.com/Test When accessing this URL, there's an EventListner (connected onKernelRequest, 31) that get the request and attach the customer to the router context. Here:

if (!$event->isMasterRequest()) { return; }

$request = $event->getRequest();
$requestContext = $this->router->getContext();

if ($company = $request->attributes->get('company')) {
   $requestContext->setParameter('company', $company);
}

This basically allow us to load our providers service by passing the argument

<argument type="expression">service('request_stack').getCurrentRequest().get('company')</argument>

The reason for that is because our application have it's own database (default) and each customer have it's own (since they're generated by a third party ETL, we only have control on segments of those database).

Now the voter definition in the service depend on one of those provider. We basically fetch the list of possible permission (map) from the database of the customer (they change per customer). Unfortunately, at the moment, the whole thing crash. I get the "No mapping file found named ..." error. He's trying to get the file from the default mapping file instead of the client mapping folder.

I've "hacked" the appdebugProjectContainer and added a print_r()|die to display the requestStack entirely and it seems completely empty. (So the request is not even pre-processed at all). Is there something I don't understand?

0

There are 0 best solutions below