dongpo5264 2014-12-14 14:57
浏览 21

Symfony - 选民依赖冲突

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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?
    • ¥15 matlab(相关搜索:紧聚焦)
    • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
    • ¥15 Arduino无法同时连接多个hx711模块,如何解决?