liip/LiipMagentoBundle — Issue #9: Symfony Module for Magento
Author: pulse00
Created: 2011-11-24 21:17:32+00:00
State: open

I've created a Symfony module for Magento to make the Symfony service container available in magento: https://github.com/pulse00/Magento-Symfony-Module

To pass the Service container over to magento during a Symfony request, i've modified your `MageListnener` service and injected the `service_container` instead of a single service. During Magento instantation, a new `symfony_on_kernel_request` Magento-Event is fired with the container as the argument.

The Symfony module on the magento side will process this event and setup a `ContainerAware` singleton which is then available to the Magento.

I've also added a `FileLoader` for Twig which is able to load Magento templates and added a Magento Block which can render Twig templates.

During a "standalone" magento request the [Symfony_Core_HttpKernel_Kernel](https://github.com/pulse00/Magento-Symfony-Module/blob/master/app/code/local/Symfony/Core/HttpKernel/Kernel.php#L15) class of the Symfony module listens to the `controller_front_init_before` event and boots a Symfony Kernel, which is currently configurable via the `config.xml`. It then sets up the ContainerAware singleton so the container is also available to Magento.

If you think the changes to your MageListener make sense in conjunction with the Magento module, i can send you a PR.