AdminSonataBundle Problème d'entity

Par cyber_truite, il y a 11 ans


Bonjour, j'ai actuellement un problème avec ce bundle lorsque j'essaye d'appeler 2 entités différentes dans un fichier Admin.

çi dessous productionAdmin.php:

namespace Kayser\PlatformBundle\Admin; use Sonata\AdminBundle\Admin\Admin; use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Form\FormMapper; class ProductionAdmin extends Admin { // Fields to be shown on create/edit forms protected function configureFormFields(FormMapper $formMapper) { $formMapper ->add('description', 'text', array('label' => 'Description')) ->add('name') ->add('url', 'entity', array( 'class' => 'KayserPlatformBundle:ProductImage', 'property' => 'name', 'multiple' => true)) ; } // Fields to be shown on filter forms protected function configureDatagridFilters(DatagridMapper $datagridMapper) { $datagridMapper ->add('name') ->add('description') ->add('url', 'entity', array( 'class' => 'KayserPlatformBundle:ProductImage', 'property' => 'name', 'multiple' => true)) ; } // Fields to be shown on lists protected function configureListFields(ListMapper $listMapper) { $listMapper ->addIdentifier('name') ->add('description') ->add('url', 'entity', array( 'class' => 'KayserPlatformBundle:ProductImage', 'property' => 'name', 'multiple' => true)) ; } }

et mon fichier admin.yml

sonata.admin.Produit: class: Kayser\PlatformBundle\Admin\ProductionAdmin tags: - { name: sonata.admin, manager_type: orm, group: "Produits", label: "Les Pains & Viennoiseries" } arguments: - ~ - Kayser\PlatformBundle\Entity\Product - ~ calls: - [ setTranslationDomain, [KayserPlatformBundle]] sonata.admin.Produit: class: Kayser\PlatformBundle\Admin\ProductionAdmin tags: - { name: sonata.admin, manager_type: orm, group: "Produits", label: "Les Pains & Viennoiseries" } arguments: - ~ - Kayser\PlatformBundle\Entity\ProductImage - ~ calls: - [ setTranslationDomain, [KayserPlatformBundle]]

Je pense que ma facon d'utiliser property est foireuse et je n'arrive pas à obtenir de résultat mise à part "No attached service to type named entity" ou que "url" n'existe pas :( Si une âme généreuse pouvait m'aider ? :)

1 réponse

cyber_truite, il y a 11 ans

Problème résolu, j'ai utilisé : ->add(category.name);