0

I am new in Symfony and I have migrated Symfony from 3 to 4. I got this error in this external service:

The "datatable" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.

I am using waldo/datatable-bundle.

Output of bin/console debug:container datatable command is :

---------------- -------------------------------------- 
  Option           Value                                 
 ---------------- -------------------------------------- 
  Service ID       datatable                             
  Class            Waldo\DatatableBundle\Util\Datatable  
  Tags             -                                     
  Public           no                                    
  Synthetic        no                                    
  Lazy             no                                    
  Shared           no                                    
  Abstract         no                                    
  Autowired        no                                    
  Autoconfigured   no                                    
 ---------------- -------------------------------------- 

When I put this into service.yml

    Waldo\DatatableBundle\WaldoDatatableBundle:
    alias: datatable
    public: true

I got this error - The service "Waldo\DatatableBundle\WaldoDatatableBundle" has a dependency on a non-existent service "templating".

Can someone help me?

VaheCh
  • 31
  • 3
  • can you review this question https://stackoverflow.com/q/48425043 ? – Ricardo Jesus Ruiz Aug 22 '22 at 12:45
  • Yes, I sow this one, but it didn't help me. – VaheCh Aug 22 '22 at 13:17
  • try to run `php bin/console debug:container templating` what is the result? this service depend from other package? – Ricardo Jesus Ruiz Aug 22 '22 at 13:39
  • `Select one of the following services to display its information:` ` [0] templating.helper.logout_url` ` [1] templating.helper.security` ` [2] Vich\UploaderBundle\Templating\Helper\UploaderHelper` – VaheCh Aug 22 '22 at 13:52
  • https://stackoverflow.com/questions/58380812/symfony-4-3-user-deprecated-the-symfony-bundle-twigbundle-loader-filesystemloa – craigh Aug 22 '22 at 15:41
  • You are trying to alias the bundle class not the datatable class. But even fixing that will only help if replace $container->get('datatable') with an injection of the Datatable service. – Cerad Aug 23 '22 at 11:14
  • @Cerad again throws error - Cannot autowire service "Waldo\DatatableBundle\Util\Datatable": argument "$entityManager" of method "__construct()" references class "Doctrine\ORM\EntityManager" but no such service exists. Try changing the type-hint to "Doctrine\ORM\EntityManagerInterface" instead. – VaheCh Aug 24 '22 at 12:28
  • Try adding an `autowire: false` to your service definition though it's a bit strange the autowire is trying to wire Datatable in the first place. That is the bundle's job. And consider updating your question with your new (properly indented) services.yml entry. Just to keep things in sync. – Cerad Aug 24 '22 at 12:40

0 Answers0