Have you ever wanted to override Symfony2 core Request class? I am the one of them. Actually what I have would liked to do is overriding isSecure method in Request class bceause of our server configuration was a bit tricky. I have googled a bit and found useful article on Symfony2 ofiicial document . It says "you should use setFactoryMethod". HOWEVER "The setFactory() method was added in Symfony 2.4". I have used Symfony2.3.X because that version has long maintenance term. I have googled and finally found the solution for Symfony 2.3.X. You just modify request creation part in web/app.php (and web/app_dev.php). require_once __DIR__.'/../app/AppKernel.php'; //require_once __DIR__.'/../app/AppCache.php'; $kernel = new AppKernel('prod', false); $kernel->loadClassCache(); //$kernel = new AppCache($kernel); // You should modify here... // ORIGINAL // $request = Request::createFromGlobals(); // I have added my original r...
IT関連の技術やプログラミングを中心に記事を書いています。ハードウェアも好きなので、日々のちょっとしたお役立ち情報も投稿しています。