This definition was added in v2.7 of Symfony https://github.com/symfony/symfony/blob/2.8/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.xml#L156
This was because TranslationsCacheWarmer was added in 2.7: https://github.com/symfony/FrameworkBundle/commit/4d4a85bed21604132db86d24d0af101518a18d50
Unfortunately this has broken some of my code, which is evident when I try to clear the Symfony cache. I use PHP to handle translations, and there is some custom code in these files (namely a DirectoryIterator which is relying on a relative path...) which is now breaking.
My plan is to come up with a proper workaround for this. However, as a short term fix - is it possible to remove that definition I reference on the first line of this message? My understanding is that this will stop the TranslationsCacheWarmer from doing anything when I run php app/console cache:clear --env=prod
I know I could probably just delete that block from translation.xml - however, that is embedded deep in the vendor/
directory which is obviously not part of my git repository. Ideally, I'd like to be able to solve this by editing my own code only, so that the change will flow through to others. I was hoping maybe there is some way for me to override this, maybe with a compiler pass or something?
Does anybody have any suggestions?
To unregister services registered by other bundles, you can use compiler pass.
It can look like:
<?php
namespace Acme\Bundle\AppBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class UnregisterThirdPartyServicesPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$container->removeDefinition('translation.warmer');
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With