sensiolabs/SensioGeneratorBundle — pull request #260 by solocommand (2014-01-23 15:37:36+00:00)
Title: Support for adding enabling multiple bundles via KernelManipulator

This PR adds support for adding multiple bundles to the AppKernel via the KernelManipulator.

Due to PHP only allowing classes to be defined once, if KernelManipulator->addBundle() is used in a loop it will eventually stop adding bundles to the AppKernel. This is because the AppKernel is read using file() before each write, getting the latest changes to the AppKernel, but the ReflectionMethod getStartLine and getEndLine methods do not reflect the latest changes. The ReflectionObject cannot be updated to a new version of the AppKernel at runtime, as the class cannot be redeclared.

Added an addBundles method to support adding an array of bundle names, and refactored addBundle/addBundles methods to prevent duplication of code.

Sorry about the diff, not nearly as clean as I was hoping it would be.