public static function onApplicationInit(Event $event)
    {
        $application = $event->getTarget();
        $container = $application->getContainer();

        if (false === $application->isDebugMode() && false === $container->isRestored()) {
            $containerFilename = $container->getParameter('container.filename');
            $containerDir = $container->getParameter('container.dump_directory');

            if (false === is_dir($containerDir) && false === @mkdir($containerDir, 0755)) {
                throw new CannotCreateContainerDirectoryException($containerDir);
            }

            if (false === is_writable($containerDir)) {
                throw new ContainerDirectoryNotWritableException($containerDir);
            }

            $dumper = new PhpArrayDumper($container);

            $dump = $dumper->dump(array('do_compile' => true));

            $container_proxy = new ContainerProxy();
            $dump = unserialize($dump);
            $container_proxy->init($dump);
            $container_proxy->setParameter('services_dump', serialize($dump['services']));
            $container_proxy->setParameter('is_compiled', $dump['is_compiled']);

            file_put_contents(
                $containerDir.DIRECTORY_SEPARATOR.$containerFilename.'.php',
                (new PhpDumper($container_proxy))->dump(array(
                    'class'      => $containerFilename,
                    'base_class' => 'BackBee\DependencyInjection\ContainerProxy',
                ))
            );
        } elseif (true === $application->isDebugMode() && false === $container->isRestored()) {
            $container->compile();
        }
    }
public static function onApplicationInit(Event $event)
    {
        $application = $event->getTarget();
        $container = $application->getContainer();

        if (false === $application->isDebugMode() && false === $container->isRestored()) {
            $containerFilename = $container->getParameter('container.filename');
            $containerDir = $container->getParameter('container.dump_directory');

            if (false === is_dir($containerDir) && false === @mkdir($containerDir, 0755)) {
                throw new CannotCreateContainerDirectoryException($containerDir);
            }

            if (false === is_writable($containerDir)) {
                throw new ContainerDirectoryNotWritableException($containerDir);
            }

            $dumper = new PhpArrayDumper($container);

            $dump = $dumper->dump(array('do_compile' => true));

            $container_proxy = new ContainerProxy();
            $dump = unserialize($dump);
            $container_proxy->init($dump);
            $container_proxy->setParameter('services_dump', serialize($dump['services']));
            $container_proxy->setParameter('is_compiled', $dump['is_compiled']);

            file_put_contents(
                $containerDir.DIRECTORY_SEPARATOR.$containerFilename.'.php',
                (new PhpDumper($container_proxy))->dump(array(
                    'class'      => $containerFilename,
                    'base_class' => 'BackBee\DependencyInjection\ContainerProxy',
                ))
            );
        } elseif (true === $application->isDebugMode() && false === $container->isRestored()) {
            $container->compile();
        }
    }
public static function onApplicationInit ( Event $ event ) { $ application = $ event -> getTarget ( ) ; $ container = $ application -> getContainer ( ) ; if ( false === $ application -> isDebugMode ( ) && false === $ container -> isRestored ( ) ) { $ containerFilename = $ container -> getParameter ( 'container.filename' ) ; $ containerDir = $ container -> getParameter ( 'container.dump_directory' ) ; if ( false === is_dir ( $ containerDir ) && false === @ mkdir ( $ containerDir , 0755 ) ) { throw new CannotCreateContainerDirectoryException ( $ containerDir ) ; } if ( false === is_writable ( $ containerDir ) ) { throw new ContainerDirectoryNotWritableException ( $ containerDir ) ; } $ dumper = new PhpArrayDumper ( $ container ) ; $ dump = $ dumper -> dump ( array ( 'do_compile' => true ) ) ; $ container_proxy = new ContainerProxy ( ) ; $ dump = unserialize ( $ dump ) ; $ container_proxy -> init ( $ dump ) ; $ container_proxy -> setParameter ( 'services_dump' , serialize ( $ dump [ 'services' ] ) ) ; $ container_proxy -> setParameter ( 'is_compiled' , $ dump [ 'is_compiled' ] ) ; file_put_contents ( $ containerDir . DIRECTORY_SEPARATOR . $ containerFilename . '.php' , ( new PhpDumper ( $ container_proxy ) ) -> dump ( array ( 'class' => $ containerFilename , 'base_class' => 'BackBee\DependencyInjection\ContainerProxy' , ) ) ) ; } elseif ( true === $ application -> isDebugMode ( ) && false === $ container -> isRestored ( ) ) { $ container -> compile ( ) ; } }
Occurs on event ``bbapplication.init`` to dump application container if debug mode is false.

@param Event $event
Occurs on event bbapplication . init to dump application container if debug mode is false .