Skip to content
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.

Admin class not found fatal error #50

Closed
gmoreira opened this issue Feb 18, 2013 · 13 comments
Closed

Admin class not found fatal error #50

gmoreira opened this issue Feb 18, 2013 · 13 comments

Comments

@gmoreira
Copy link

This bundle now depends on Admin Bundle to be installed.

PHP Fatal error: Class 'Sonata\AdminBundle\Admin\Admin' not found in /Users/gabriel/Zend/workspaces/PM2/PMAppMIBundle/vendor/sonata-project/notification-bundle/Sonata/NotificationBundle/Admin/MessageAdmin.php on line 21

@rande, Can this dependency be removed as it breaks the usefulness of the notification bundle.

@rande
Copy link
Member

rande commented Feb 18, 2013

it breaks the usefulness of the notification bundle. not sure about this statement ;) but yes I will fix this issue asap

@gmoreira
Copy link
Author

Cheers mate!

@rande
Copy link
Member

rande commented Feb 18, 2013

fix ba8c824

@rande rande closed this as completed Feb 18, 2013
@derekclapham
Copy link

Hey @rande. Just pulled that latest commit with a composer update. Getting a fatal error when generating the autoload files:

PHP Fatal error: Class 'Sonata\AdminBundle\Controller\CRUDController' not found in vendor/sonata-project/notification-bundle/Sonata/NotificationBundle/Controller/MessageAdminController.php on line 21

@rande
Copy link
Member

rande commented Feb 18, 2013

@derekclapham so the error is coming from post install script? Why autoload try to open this file?!

@pulse00
Copy link
Contributor

pulse00 commented Feb 19, 2013

@rande during composer.phar update in our setup, we're running into the same error. It happens at

JMS\DiExtraBundle\HttpKernel\ControllerInjectorsWarmer->findControllerClasses()  JMS/DiExtraBundle/HttpKernel/ControllerInjectorsWarmer.php:35

It looks like the JMS/DiExtraBundle/HttpKernel/ControllerInjectorsWarmer.php detects the MessageAdminController and tries to autoload.

see findControllerClasses in the JMSDiExtraBundle

@rande
Copy link
Member

rande commented Feb 19, 2013

@pulse00 there is an option https://github.com/schmittjoh/JMSDiExtraBundle/blob/master/HttpKernel/ControllerInjectorsWarmer.php#L59-L61

Not sure how this value is injected and how we can alter it to include the controlle, but this can be a solution.

More over, I don't want to create a new bundle

@pulse00
Copy link
Contributor

pulse00 commented Feb 19, 2013

@rande right, i'll check how to blacklist it, thanks.

@rande
Copy link
Member

rande commented Feb 19, 2013

@pulse00 The only viable option for now will be to add a compiler pass to add new class on the jms_di_extra.cache_warmer.controller_file_blacklist parameter

https://github.com/schmittjoh/JMSDiExtraBundle/blob/master/Resources/config/services.xml#L62

@schmittjoh is the ``require` option the only solution ?

@pulse00
Copy link
Contributor

pulse00 commented Feb 19, 2013

@rande using this configuration, the app boots fine:

jms_di_extra:
    cache_warmer:         
        enabled:              true 
        controller_file_blacklist:
          - "%kernel.root_dir%/../vendor/sonata-project/notification-bundle/Sonata/NotificationBundle/Controller/MessageAdminController.php"

@schmittjoh
Copy link

You can automatically blacklist files by adding something like this to your bundle's class:

public function build(ContainerBuilder $container)
{
    if ($container->hasExtension('jms_di_extra')) {
        $container->getExtension('jms_di_extra')->blacklistControllerFile($yourFileHere);
    }
}

That way users will not have to care about blacklisting.

@rande
Copy link
Member

rande commented Feb 19, 2013

@schmittjoh I was looking for that!! great!
@pulse00 can you create a PR ?

@pulse00
Copy link
Contributor

pulse00 commented Feb 19, 2013

@rande done.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants