{"action":"opened","issue":{"url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues/2716","labels_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues/2716/labels{/name}","comments_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues/2716/comments","events_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues/2716/events","html_url":"https://github.com/sonata-project/SonataAdminBundle/issues/2716","id":57020058,"number":2716,"title":"Nested form : Can't reach a nested entity","user":{"login":"PxlCtzn","id":1590432,"avatar_url":"https://avatars.githubusercontent.com/u/1590432?v=3","gravatar_id":"","url":"https://api.github.com/users/PxlCtzn","html_url":"https://github.com/PxlCtzn","followers_url":"https://api.github.com/users/PxlCtzn/followers","following_url":"https://api.github.com/users/PxlCtzn/following{/other_user}","gists_url":"https://api.github.com/users/PxlCtzn/gists{/gist_id}","starred_url":"https://api.github.com/users/PxlCtzn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PxlCtzn/subscriptions","organizations_url":"https://api.github.com/users/PxlCtzn/orgs","repos_url":"https://api.github.com/users/PxlCtzn/repos","events_url":"https://api.github.com/users/PxlCtzn/events{/privacy}","received_events_url":"https://api.github.com/users/PxlCtzn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-09T11:41:15Z","updated_at":"2015-02-09T11:41:15Z","closed_at":null,"body":"Hi folks,\r\n\r\nHere is my pb: I can not reach the variable 'label' of the EquipmentML entity inside the *Edit hostel* form.\r\n**tl;dr** : An hostel contains multiple Equipments (oneToMany) (joinTable : HostelEquipment). Each HostelEquipment can be visible or not (that's why I set up the joinTable manually). Moreover the name of the Equipment is available in various language (5 of them). To do so, the Equipment are linked to the EquipmentML entity.\r\nSo basically : Hostel  -> HostelEquipment -> Equipment -> EquipmentML\r\nI'm stuck to the Equipment. I can get all the equipments but not the EquipmentML associated.\r\n\r\nI rtfm but I did not find anything on this specific topic so all the help will be appreciate.\r\n\r\nI have the following entities : \r\n**Hostel** (tl;dr: *describes an hostel*)\r\n```php\r\n/**\r\n * Hostel\r\n * @ORM\\Entity(repositoryClass=\"AppBundle\\Repository\\HostelRepository\")\r\n * @ORM\\Table(name=\"hostel\")\r\n * UniqueEntity(\"code\")\r\n */\r\nclass Hostel\r\n{\r\n    /**\r\n     * @var integer\r\n     *\r\n     * @ORM\\Column(name=\"id\", type=\"integer\")\r\n     * @ORM\\Id\r\n     * @ORM\\GeneratedValue(strategy=\"AUTO\")\r\n     */\r\n    private $id;\r\n    // [...]\r\n    /**\r\n     * @var ArrayCollection\r\n     * @ORM\\OneToMany(targetEntity=\"HostelEquipment\", mappedBy=\"hostel\" , cascade={\"persist\", \"remove\"})\r\n     * @ORM\\JoinColumn(name=\"equipment_id\", referencedColumnName=\"id\")\r\n     */\r\n    private $hostelEquipments;\r\n}\r\n```\r\n**HostelEquipment** (tl;dr: *link an equipment to an hostel + contains a boolean to set if the equipment is visible or not*)\r\n```php\r\n/**\r\n * Describe an Equipment\r\n * @ORM\\Entity\r\n * @ORM\\Table(name=\"hostel_equipment\")\r\n */\r\nclass HostelEquipment\r\n{\r\n    /**\r\n     * ManyToOne Unidirectional\r\n     * @ORM\\Id\r\n     * @ORM\\ManyToOne(targetEntity=\"Hostel\", inversedBy=\"hostelEquipments\", cascade={\"persist\", \"remove\"})\r\n     * @ORM\\JoinColumn(name=\"hostel_id\", referencedColumnName=\"id\")\r\n     */\r\n    private $hostel;\r\n\r\n    /**\r\n     * @ORM\\Id\r\n     * @var Equipment $equipment\r\n     * ManyToOne Unidirectional\r\n     * @ORM\\ManyToOne(targetEntity=\"Equipment\",  cascade={\"persist\", \"remove\"})\r\n     * @ORM\\JoinColumn(name=\"equipment_id\", referencedColumnName=\"id\")\r\n     */\r\n    private $equipment;\r\n\r\n    /**\r\n     * @var boolean\r\n     * @ORM\\Column(name=\"status\", type=\"boolean\");\r\n     */\r\n    private $status;\r\n    // [...]\r\n}\r\n```\r\n**Equipment** (tl;dr: *one equipment*)\r\n```php\r\n/**\r\n * Describe an Equipment\r\n * @ORM\\Entity\r\n * @ORM\\Table(name=\"equipment\")\r\n */\r\nclass Equipment\r\n{\r\n    /**\r\n     * @var integer\r\n     *\r\n     * @ORM\\Column(name=\"id\", type=\"integer\")\r\n     * @ORM\\Id\r\n     * @ORM\\GeneratedValue(strategy=\"AUTO\")\r\n     */\r\n    private $id;\r\n\r\n    /**\r\n     * @var ArrayCollection $equipmentML\r\n     * @ORM\\OneToMany(targetEntity=\"EquipmentML\", mappedBy=\"equipment\")\r\n     * @ORM\\JoinColumn(name=\"equipment_multilanguage_id\", referencedColumnName=\"id\")\r\n     */\r\n    private $equipmentML;\r\n    // [...]\r\n}\r\n```\r\n**EquipmentML** (tl;dr: *Contains the entity's data for multi-language support*)\r\n```php\r\n/**\r\n * @ORM\\Entity\r\n * @ORM\\Table(name=\"equipment_multilanguage\")\r\n */\r\nclass EquipmentML {\r\n    /**\r\n     * @var LanguageFO $languageFO\r\n     * @ORM\\Id\r\n     * @ORM\\ManyToOne(targetEntity=\"LanguageFO\")\r\n     * @ORM\\JoinColumn(name=\"language_fo_id\", referencedColumnName=\"id\")\r\n     */\r\n    private $languageFO;\r\n\r\n    /**\r\n     * @var Equipment $equipment\r\n     * @ORM\\Id\r\n     * @ORM\\ManyToOne(targetEntity=\"Equipment\", inversedBy=\"equipmentML\")\r\n     * @ORM\\JoinColumn(name=\"equipment_id\", referencedColumnName=\"id\")\r\n     */\r\n    private $equipment;\r\n\r\n    /**\r\n     * @var string $label\r\n     * @ORM\\Column(name=\"label\", type=\"text\")\r\n     */\r\n    private $label;\r\n    // [...]\r\n}\r\n```\r\n\r\n\r\nHere is my *services.yml*  : \r\n```yaml\r\nservices:\r\n    sonata.admin.hostel:\r\n          class: AppBundle\\Admin\\HostelAdmin\r\n          tags:\r\n              - { name: sonata.admin, manager_type: orm, group: \"hostel\", label: \"Hostel\" }\r\n          arguments:\r\n              - ~\r\n              - AppBundle\\Entity\\Hostel\r\n              - AppBundle:HostelAdmin\r\n          calls:\r\n              - [ setTranslationDomain,   [AppBundle]]\r\n    sonata.admin.equipment:\r\n          class: AppBundle\\Admin\\EquipmentAdmin\r\n          tags:\r\n              - { name: sonata.admin, manager_type: orm, group: \"hostel\", label: \"Equipment\" }\r\n          arguments:\r\n              - ~\r\n              - AppBundle\\Entity\\Equipment\r\n              - ~\r\n          calls:\r\n              - [ setTranslationDomain,   [AppBundle]]\r\n    sonata.admin.equipmentML:\r\n          class: AppBundle\\Admin\\EquipmentMLAdmin\r\n          tags:\r\n              - { name: sonata.admin, manager_type: orm, group: \"hostel\", label: \"EquipmentML\" }\r\n          arguments:\r\n              - ~\r\n              - AppBundle\\Entity\\EquipmentML\r\n              - ~\r\n          calls:\r\n              - [ setTranslationDomain,   [AppBundle]]\r\n    sonata.admin.hostelEquipment:\r\n          class: AppBundle\\Admin\\HostelEquipmentAdmin\r\n          tags:\r\n              - { name: sonata.admin, manager_type: orm, group: \"hostel\", label: \"HostelEquipment\" }\r\n          arguments:\r\n              - ~\r\n              - AppBundle\\Entity\\HostelEquipment\r\n              - ~\r\n          calls:\r\n              - [ setTranslationDomain,   [AppBundle]]\r\n```\r\n\r\nAnd, at last, the Admins classes : \r\n**HostelAdmin** (tl;dr *Add the 'hostelEquipments' as a sonata_type_collection*)\r\n```php\r\nclass HostelAdmin extends Admin {\r\n    protected function configureFormFields(FormMapper $form)    {\r\n        $form->add('hostelEquipments', 'sonata_type_collection');\r\n    }\r\n}\r\n```\r\n**HostelEquipmentAdmin** (tl;dr *Add the 'equipment' as a 'sonata_type_collection'*)\r\n```php\r\nclass HostelEquipmentAdmin extends Admin\r\n{\r\n    protected function configureFormFields(FormMapper $form) {\r\n        $form->add('equipment', 'sonata_type_model');\r\n    }\r\n}\r\n```\r\n**EquipmentAdmin** (tl;dr *Add the 'equipmentML' as a 'sonata_type_collection'*)\r\n```php\r\nclass EquipmentAdmin extends Admin\r\n{\r\n    protected function configureFormFields(FormMapper $form) {\r\n        $form->add('equipmentML', 'sonata_type_collection');\r\n    }\r\n}\r\n```\r\n**EquipmentMLAdmin** (tl;dr *Add the 'equipmentML' as a 'sonata_type_collection'*)\r\n```php\r\nclass EquipmentMLAdmin extends Admin\r\n{\r\n    protected function configureFormFields(FormMapper $form)\r\n    {\r\n        $form->add('label');\r\n    }\r\n}\r\n```"}}