2017-12-26 12 views
1

私はsymfony 3を使用しています。私は管理サイドを管理して自分の電子商取引Webサイトの製品と私のコマンドを管理しようとしますが、ReflectionException:クラスAdmin AdminBundle Admin Entity Produitが存在しません

ReflectionException - クラス管理\ AdminBundle \管理\エンティティ\製品は

存在しない、これは私のサービスである:

services: 
app.admin.produit: 
    class: Admin\AdminBundle\Admin\ProduitAdmin 
    tags: 
     - { name: sonata.admin, manager_type: orm, group: "Content", label: "Produit" } 
    arguments: 
     - ~ 
     - Admin\AdminBundle\Admin\Entity\Produit 
     - ~ 
    calls: 
     - [ setTranslationDomain, [AdminAdminBundle]] 
    public: true 


app.admin.commande: 
    class: Admin\AdminBundle\Admin\CommandeAdmin 
    tags: 
     - { name: sonata.admin, manager_type: orm, group: "Content", label: "Commande" } 
    arguments: 
     - ~ 
     - Admin\AdminBundle\Admin\Entity\Commande 
     - ~ 
    calls: 
     - [ setTranslationDomain, [AdminAdminBundle]] 
    public: true 

これは私のCommandAdminです:

<?php 
    namespace Admin\AdminBundle\Admin; 



    use Sonata\AdminBundle\Admin\AbstractAdmin; 
     use Sonata\AdminBundle\Show\ShowMapper; 
     use Sonata\AdminBundle\Form\FormMapper; 
     use Sonata\AdminBundle\Datagrid\ListMapper; 
     use Sonata\AdminBundle\Datagrid\DatagridMapper; 

class CommandeAdmin extends AbstractAdmin 
{ 
    // Fields to be shown on create/edit forms 
    protected function configureFormFields(FormMapper $formMapper) 
    { 
     $formMapper 
      ->add('idProduit', 'entity', array('class' => 'Admin\AdminBundle\Entity\Produit')) 
      ->add('date') 
     ; 
    } 

    // Fields to be shown on filter forms 
    protected function configureDatagridFilters(DatagridMapper $datagridMapper) 
    { 
     $datagridMapper 
      // ->add('idProduit') 
      ->add('date') 
     ; 
    } 

    // Fields to be shown on lists 
    protected function configureListFields(ListMapper $listMapper) 
    { 
     $listMapper 
      ->addIdentifier('idProduit', 'entity', array('class' => 'Admin\AdminBundle\Entity\Produit')) 
      ->add('date') 
     ; 
    } 

    // Fields to be shown on show action 
    protected function configureShowFields(ShowMapper $showMapper) 
    { 
     $showMapper 
      ->add('idProduit') 
      ->add('date') 
     ; 
    } 
} 

これは私のProduitAdminです:

<?php 
namespace Admin\AdminBundle\Admin; 

use Sonata\AdminBundle\Admin\AbstractAdmin; 
use Sonata\AdminBundle\Show\ShowMapper; 
use Sonata\AdminBundle\Form\FormMapper; 
use Sonata\AdminBundle\Datagrid\ListMapper; 
use Sonata\AdminBundle\Datagrid\DatagridMapper; 

class ProduitAdmin extends AbstractAdmin 
{ 
    // Fields to be shown on create/edit forms 
    protected function configureFormFields(FormMapper $formMapper) 
    { 
     $formMapper 
      ->add('nom') 
      ->add('description') 
      ->add('quantite') 
      ->add('prix') 
      ->add('marque') 
      ->add('fournisseur') 
     ; 
    } 

    // Fields to be shown on filter forms 
    protected function configureDatagridFilters(DatagridMapper $datagridMapper) 
    { 
     $datagridMapper 
      ->add('nom') 
      ->add('description') 
      ->add('quantite') 
      ->add('prix') 
      ->add('marque') 
      ->add('fournisseur') 
     ; 
    } 

    // Fields to be shown on lists 
    protected function configureListFields(ListMapper $listMapper) 
    { 
     $listMapper 
      ->addIdentifier('nom') 
      ->add('description') 
      ->add('quantite') 
      ->add('prix') 
      ->add('marque') 
      ->add('fournisseur') 
     ; 
    } 

    // Fields to be shown on show action 
    protected function configureShowFields(ShowMapper $showMapper) 
    { 
     $showMapper 
      ->add('nom') 
      ->add('description') 
      ->add('quantite') 
      ->add('prix') 
      ->add('marque') 
      ->add('fournisseur') 
     ; 
    } 
} 

これはスタックトレースです:

ReflectionException: 
Class Admin\AdminBundle\Admin\Entity\Produit does not exist 

    at vendor/sonata-project/admin-bundle/Controller/CRUDController.php:480 
    at ReflectionClass->__construct('Admin\\AdminBundle\\Admin\\Entity\\Produit') 
    (vendor/sonata-project/admin-bundle/Controller/CRUDController.php:480) 
    at Sonata\AdminBundle\Controller\CRUDController->createAction() 
    at call_user_func_array(array(object(CRUDController), 'createAction'), array()) 
    (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:153) 
    at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1) 
    (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68) 
    at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true) 
    (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:169) 
    at Symfony\Component\HttpKernel\Kernel->handle(object(Request)) 
    (web/app_dev.php:29) 

誰かが

+0

'' Admin \ AdminBundle \ Admin \ Entity \ Product'''が存在するかどうかチェックしましたか? – Wolen

答えて

0

アイデアを持っている場合は、エラーがかなり説明できるである:クラスAdmin\AdminBundle\Admin\Entity\Produitはしていません存在するようです。あなたのコードを見て、そこにはないと思います。

Admin\AdminBundle\Entity\Produit(削除されたAdmin\サブネームスペースに注意してください)と思っています。あなたのCommandeクラスの直下にも同じことが当てはまります。

+0

ありがとうございます。私の問題は修正されました。スティック –

関連する問題