rekalogika/mapper

Non-existent service "rekalogika.mapper.cache.property_info"

Closed this issue · 4 comments

Just after installation of your package I got an error while running cache:clear:

In DecoratorServicePass.php line 88:
                                                                                                                                             
  The service "rekalogika.mapper.cache.property_info.traceable" has a dependency on a non-existent service "rekalogika.mapper.cache.propert  
  y_info". 

Symfony version 7, package version 1.1.1, environment: dev, installed with Flex, APP_DEBUG: true

Seems the reason is in DebugPass, which removes this definition from container if app_debug is enabled. But on dev environment I obviously have it enabled...

I cannot reproduce the error from a clean install:

symfony new --webapp test
cd test
composer require rekalogika/mapper

You probably have another bundle decorating the service. Try running this:

bin/console debug:container rekalogika.mapper.cache.property_info.traceable

If it gives an error, try editing DebugPass.php and comment out the removeDefinition() lines.

Exception trace:

In DecoratorServicePass.php line 88:
                                                                                                                                             
  [Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]                                                                 
  The service "rekalogika.mapper.cache.property_info.traceable" has a dependency on a non-existent service "rekalogika.mapper.cache.propert  
  y_info".                                                                                                                                   
                                                                                                                                             

Exception trace:
  at /app/device/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php:88
 Symfony\Component\DependencyInjection\Compiler\DecoratorServicePass->process() at /app/device/vendor/symfony/dependency-injection/Compiler/Compiler.php:73
 Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /app/device/vendor/symfony/dependency-injection/ContainerBuilder.php:750
 Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /app/device/vendor/symfony/http-kernel/Kernel.php:488
 Symfony\Component\HttpKernel\Kernel->initializeContainer() at /app/device/vendor/symfony/http-kernel/Kernel.php:725
 Symfony\Component\HttpKernel\Kernel->preBoot() at /app/device/vendor/symfony/http-kernel/Kernel.php:123
 Symfony\Component\HttpKernel\Kernel->boot() at /app/device/vendor/symfony/framework-bundle/Console/Application.php:179
 Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands() at /app/device/vendor/symfony/framework-bundle/Console/Application.php:71
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /app/device/vendor/symfony/console/Application.php:169
 Symfony\Component\Console\Application->run() at /app/device/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49
 Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run() at /app/device/vendor/autoload_runtime.php:29
 require_once() at /app/device/bin/console:11

debug:container

 ./bin/console debug:container rekalogika.mapper.cache.property_info.traceable     

Information for Service "rekalogika.mapper.cache.property_info.traceable"
=========================================================================

 This implementation of a cache adapter supports the distributed tracing feature of Sentry.

 ---------------- ------------------------------------------------------------------------------------------------------------------------------- 
  Option           Value                                                                                                                          
 ---------------- ------------------------------------------------------------------------------------------------------------------------------- 
  Service ID       rekalogika.mapper.cache.property_info.traceable                                                                                
  Class            Sentry\SentryBundle\Tracing\Cache\TraceableCacheAdapter                                                                        
  Tags             cache.pool                                                                                                                     
                   kernel.reset (method: reset)                                                                                                   
                   container.decorator (id: rekalogika.mapper.cache.property_info, inner: rekalogika.mapper.cache.property_info.traceable.inner)  
  Public           no                                                                                                                             
  Synthetic        no                                                                                                                             
  Lazy             no                                                                                                                             
  Shared           yes                                                                                                                            
  Abstract         no                                                                                                                             
  Autowired        no                                                                                                                             
  Autoconfigured   no                                                                                                                             
  Usages           rekalogika.mapper.cache.property_info                                                                                          
                   services_resetter                                                                                                              
                   cache.system_clearer                                                                                                           
                   cache.global_clearer                                                                                                           
                   rekalogika.mapper.property_info.cache                                                                                          
 ---------------- ------------------------------------------------------------------------------------------------------------------------------- 

Reordering bundle with SentryBundle fixed the problem. Not sure if it's expected behaviour or not )

It should be fixed with #50

Previously, it sets property info caching, and removes it if debug is enabled. Now it doesn't set caching by default, only enabling it if debug is disabled.