Pregunta

When I try to use the argument setSubClasses in my services definition, the name of the subclass added to the Admin has a letter removed

Here's my definition

sonata.admin.question:
    class: Hippy\ScavengerHuntBundle\Admin\QuestionAdmin
    tags:
        - { name: sonata.admin, manager_type: orm, group: "Questions", label: "Question" }
    arguments:
        - ~
        - Hippy\ScavengerHuntBundle\Entity\Question
        - ~
    calls:
        - [ setTranslationDomain, [HippyScavengerHuntBundle]]
        - [ setSubClasses, [{lettersInOrderQuestion : "Hippy\ScavengerHuntBundle\Entity\LettersInOrderQuestion"}]]

In my admin class, under the configureFormFields method, I put the following line and the result was quite surprising:

var_dump($this->getSubClasses());

The result:

array (size=1)
  'lettersInOrderQuestion' => string 'Hippy\ScavengerHuntBundle\Entity
ettersInOrderQuestion' (length=56)

It looks like the "\L" got removed somehow... normally, it would be Entity\LettersInOrderQuestion not EntityettersInOrderQuestion

¿Fue útil?

Solución

Don't put your namespace around the namespace. Therefore, you should write the following :

{lettersInOrderQuestion : Hippy\ScavengerHuntBundle\Entity\LettersInOrderQuestion}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top