sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

Fatal error: Class 'MyApp\FilmothequeBundle\Admin\ActeurAdmin' not found in C:\wamp\www\Symfony2\app\cache\dev\appDevDebugProjectContainer.php on line 2894 #720

Closed kach307 closed 12 years ago

kach307 commented 12 years ago

after installing SonataAdminBundle i created admin class in "C:\wamp\www\Symfony2\src\MyApp\FilmothequeBundle\Admin" and i had this error <Fatal error: Class 'MyApp\FilmothequeBundle\Admin\ActeurAdmin' not found in C:\wamp\www\Symfony2\app\cache\dev\appDevDebugProjectContainer.php on line 2894> this is my files

// AppKernel

class AppKernel extends Kernel { public function registerBundles() { $bundles = array( new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Symfony\Bundle\DoctrineBundle\DoctrineBundle(), new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(), new MyApp\FilmothequeBundle\MyAppFilmothequeBundle(), new FOS\UserBundle\FOSUserBundle(), new MyApp\UtilisateurBundle\MyAppUtilisateurBundle(), new Knp\Bundle\MenuBundle\KnpMenuBundle(), new Sonata\jQueryBundle\SonatajQueryBundle(), new Sonata\AdminBundle\SonataAdminBundle(), new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),

    );

//autoload.php

$loader->registerNamespaces(array( 'Doctrine\ODM' => DIR.'/../vendor/doctrine-mongodb-odm/lib', 'Doctrine\MongoDB' => DIR.'/../vendor/doctrine-mongodb/lib', 'Doctrine\Bundle' => DIR.'/../vendor/bundles', 'Doctrine\Common\DataFixtures' => DIR.'/../vendor/doctrine-fixtures/lib', 'Propel' => DIR.'/../vendor/bundles', 'WhiteOctober\PagerfantaBundle' => DIR.'/../vendor/bundles', 'Pagerfanta' => DIR.'/../vendor/pagerfanta/src', 'TwigGenerator' => DIR.'/../vendor/twig-generator/src', 'Symfony' => array(DIR.'/../vendor/symfony/src', DIR.'/../vendor/bundles'), 'Sensio' => DIR.'/../vendor/bundles', 'JMS' => DIR.'/../vendor/bundles', 'Doctrine\Common' => DIR.'/../vendor/doctrine-common/lib', 'Doctrine\DBAL' => DIR.'/../vendor/doctrine-dbal/lib', 'Doctrine' => DIR.'/../vendor/doctrine/lib', 'Monolog' => DIR.'/../vendor/monolog/src', 'Assetic' => DIR.'/../vendor/assetic/src', 'Metadata' => DIR.'/../vendor/metadata/src', 'FOS' => DIR.'/../vendor/bundles', 'Stfalcon' => DIR.'/../vendor/bundles', 'Knp\Bundle' => DIR.'/../vendor/bundles', 'Knp\Menu' => DIR.'/../vendor/KnpMenu/src', 'Sonata' => DIR.'/../vendor/bundles',

//config.yml

jms_security_extra: secure_controllers: true secure_all_services: false fos_user: db_driver: orm firewall_name: main use_listener: false user_class: MyApp\UtilisateurBundle\Entity\Utilisateur knp_menu: twig: # use "twig: false" to disable the Twig extension and the TwigRenderer template: knp_menu.html.twig templating: false # if true, enables the helper for PHP templates default_renderer: twig # The renderer to use, list is also available by default

services:

...

tutorial.blog.admin.comment: class: MyApp\FilmothequeBundle\Admin\ActeurAdmin tags:

//ActeurAdmin.php

class ActeurAdmin extends Admin {

public function configureShowField(ShowMapper $showMapper)
{
    $showMapper
        ->add('nom')
        ->add('prenom')
        ->add('dateNaissance')
        ->add('sexe')
    ;}

public function configureFormFields(FormMapper $formMapper) { $formMapper ->with('General') ->add('nom') ->add('prenom') ->add('dateNaissance') ->add('sexe') ->end() ; } public function configureListFields(ListMapper $listMapper) { $listMapper ->addIdentifier('title') ->add('nom') ->add('prenom') ->add('dateNaissance') ->add('sexe') ->add('_action', 'actions', array( 'actions' => array( 'view' => array(), 'edit' => array(), 'delete' => array(), ) )) ; } public function configureDatagridFilters(DatagridMapper $datagridMapper) { $datagridMapper ->add('title') ->add('enabled') ->add('tags', null, array('field_options' => array('expanded' => true, 'multiple' => true))) ; } }

thinks

rande commented 12 years ago

fix your autoload.php file