Skip to content

Hard dependency in Kernel #10265

@felixcarmona

Description

@felixcarmona

https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Kernel.php

/**
 * Dumps the service container to PHP code in the cache.
 *
 * @param ConfigCache      $cache     The config cache
 * @param ContainerBuilder $container The service container
 * @param string           $class     The name of the class to generate
 * @param string           $baseClass The name of the container's base class
 */
protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, $class, $baseClass)
{
    // cache the container
    $dumper = new PhpDumper($container);

    if (class_exists('ProxyManager\Configuration')) {
        $dumper->setProxyDumper(new ProxyDumper());
    }

    $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass));
    if (!$this->debug) {
        $content = static::stripComments($content);
    }

    $cache->write($content, $container->getResources());
}

We need change the dumper (we need rewrite the addDefaultParametersMethod behavior, because we need not compile the

 protected function getDefaultParameters()
 {
    return $parameters;
 }

in the ProjectContainer cache (we want to do something like a:

protected function getDefaultParameters()
{
    return include("our_not_cached_parameters.php");
}

but we can't modify the dump container without copy/pasting all the dumpContainer function content in our child AppKernel

why is this class a hard dependency?
why not save the object in the kernel properties and do $this->dumper->something / or as service in the container, etc?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions