I'm on Symfony 2.7 and I need to override Symfony \ Component \ Asset \ UrlPackage
I looked at http://symfony.com/doc/current/cookbook/bundles/override.html
and http://symfony.com/doc/current/cookbook/service_container/compiler_passes.html
but cannot make it work.
I made a file in my package MyApp \ CoreBundle \ Overrides \ UrlPackage; I registered UrlPackage as a service and added a function:
public function process(ContainerBuilder $container)
{
$definition = $container->getDefinition('assets.url_package');
$definition->setClass('MyApp\CoreBundle\Overrides\UrlPackage');
}
Strange if I call $this->has('assets.url_package')in any controller, it returns false. I grabbed it from a services file in Symfony:
<service id="assets.url_package" class="Symfony\Component\Asset\UrlPackage" abstract="true">
<argument />
<argument type="service" />
<argument type="service" id="assets.context" />
</service>
If I run php app/console debug:container, UrlPackage from symfony does not exist, but if I change something inside the vendor / * / UrlPackge file, it works
- ?