{"action":"opened","issue":{"url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/1447","repository_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle","labels_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/1447/labels{/name}","comments_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/1447/comments","events_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/1447/events","html_url":"https://github.com/javiereguiluz/EasyAdminBundle/issues/1447","id":197863738,"number":1447,"title":"One to Many relationship -> don't update/delete","user":{"login":"alexcandy91","id":16149868,"avatar_url":"https://avatars.githubusercontent.com/u/16149868?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcandy91","html_url":"https://github.com/alexcandy91","followers_url":"https://api.github.com/users/alexcandy91/followers","following_url":"https://api.github.com/users/alexcandy91/following{/other_user}","gists_url":"https://api.github.com/users/alexcandy91/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcandy91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcandy91/subscriptions","organizations_url":"https://api.github.com/users/alexcandy91/orgs","repos_url":"https://api.github.com/users/alexcandy91/repos","events_url":"https://api.github.com/users/alexcandy91/events{/privacy}","received_events_url":"https://api.github.com/users/alexcandy91/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-28T14:43:11Z","updated_at":"2016-12-28T14:43:11Z","closed_at":null,"body":"Hello, \r\nI have some problem on Delete / Update a entity relationship with this bundle.\r\n\r\nFor example : I have the relationship OneToMany with Country and Site \r\n```\r\n<?php\r\n\r\nnamespace AppBundle\\Entity;\r\n\r\nuse Doctrine\\ORM\\Mapping as ORM;\r\n\r\n/**\r\n * Country\r\n *\r\n * @ORM\\Table(name=\"country\")\r\n * @ORM\\Entity(repositoryClass=\"AppBundle\\Repository\\CountryRepository\")\r\n */\r\nclass Country\r\n{\r\n    /**\r\n     * @var int\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 string\r\n     *\r\n     * @ORM\\Column(name=\"name\", type=\"string\", length=255)\r\n     */\r\n    private $name;\r\n\r\n    /**\r\n     * @var string\r\n     *\r\n     * @ORM\\Column(name=\"value\", type=\"string\", length=255, unique=true)\r\n     */\r\n    private $value;\r\n\r\n    /**\r\n     * @ORM\\OneToMany(targetEntity=\"Site\", mappedBy=\"country\", cascade={\"persist\", \"remove\"})\r\n     * @ORM\\JoinColumn(name=\"site\", referencedColumnName=\"id\", nullable=true)\r\n     */\r\n    private $site;\r\n\r\n    function __toString()\r\n    {\r\n        return $this->name .\"(\".$this->getValue().\")\";\r\n    }\r\n    /**\r\n     * @return int\r\n     */\r\n    public function getId()\r\n    {\r\n        return $this->id;\r\n    }\r\n\r\n    /**\r\n     * @param int $id\r\n     * @return Country\r\n     */\r\n    public function setId($id)\r\n    {\r\n        $this->id = $id;\r\n        return $this;\r\n    }\r\n\r\n    /**\r\n     * @return string\r\n     */\r\n    public function getName()\r\n    {\r\n        return $this->name;\r\n    }\r\n\r\n    /**\r\n     * @param string $name\r\n     * @return Country\r\n     */\r\n    public function setName($name)\r\n    {\r\n        $this->name = $name;\r\n        return $this;\r\n    }\r\n\r\n    /**\r\n     * @return string\r\n     */\r\n    public function getValue()\r\n    {\r\n        return $this->value;\r\n    }\r\n\r\n    /**\r\n     * @param string $value\r\n     * @return Country\r\n     */\r\n    public function setValue($value)\r\n    {\r\n        $this->value = $value;\r\n        return $this;\r\n    }\r\n\r\n    /**\r\n     * @return mixed\r\n     */\r\n    public function getSite()\r\n    {\r\n        return $this->site;\r\n    }\r\n\r\n    /**\r\n     * @param mixed $site\r\n     * @return Country\r\n     */\r\n    public function setSite($site)\r\n    {\r\n        $this->site = $site;\r\n        return $this;\r\n    }\r\n\r\n\r\n}\r\n\r\n```\r\n\r\n```\r\n<?php\r\n\r\nnamespace AppBundle\\Entity;\r\n\r\nuse Doctrine\\ORM\\Mapping as ORM;\r\n\r\n/**\r\n * Site\r\n *\r\n * @ORM\\Table(name=\"site\")\r\n * @ORM\\Entity(repositoryClass=\"AppBundle\\Repository\\SiteRepository\")\r\n */\r\nclass Site\r\n{\r\n    /**\r\n     * @var int\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 string\r\n     *\r\n     * @ORM\\Column(name=\"siteId\", type=\"string\", length=255)\r\n     */\r\n    private $siteId;\r\n\r\n    /**\r\n     * @var string\r\n     *\r\n     * @ORM\\Column(name=\"name\", type=\"string\", length=255)\r\n     */\r\n    private $name;\r\n\r\n    /**\r\n     * @ORM\\ManyToOne(targetEntity=\"Country\", inversedBy=\"site\")\r\n     * @ORM\\JoinColumn(name=\"country\", referencedColumnName=\"id\", nullable=true)\r\n     */\r\n    private $country;\r\n\r\n    function __toString()\r\n    {\r\n        return $this->siteId .\" - \".$this->name;\r\n    }\r\n\r\n\r\n    /**\r\n     * @return int\r\n     */\r\n    public function getId()\r\n    {\r\n        return $this->id;\r\n    }\r\n\r\n    /**\r\n     * @param int $id\r\n     * @return Site\r\n     */\r\n    public function setId($id)\r\n    {\r\n        $this->id = $id;\r\n        return $this;\r\n    }\r\n\r\n    /**\r\n     * @return string\r\n     */\r\n    public function getSiteId()\r\n    {\r\n        return $this->siteId;\r\n    }\r\n\r\n    /**\r\n     * @param string $siteId\r\n     * @return Site\r\n     */\r\n    public function setSiteId($siteId)\r\n    {\r\n        $this->siteId = $siteId;\r\n        return $this;\r\n    }\r\n\r\n    /**\r\n     * @return string\r\n     */\r\n    public function getName()\r\n    {\r\n        return $this->name;\r\n    }\r\n\r\n    /**\r\n     * @param string $name\r\n     * @return Site\r\n     */\r\n    public function setName($name)\r\n    {\r\n        $this->name = $name;\r\n        return $this;\r\n    }\r\n\r\n    /**\r\n     * @return mixed\r\n     */\r\n    public function getCountry()\r\n    {\r\n        return $this->country;\r\n    }\r\n\r\n    /**\r\n     * @param mixed $country\r\n     * @return Site\r\n     */\r\n    public function setCountry($country)\r\n    {\r\n        $this->country = $country;\r\n        return $this;\r\n    }\r\n\r\n    /**\r\n     * @return mixed\r\n     */\r\n    public function getSite()\r\n    {\r\n        return $this->site;\r\n    }\r\n\r\n    /**\r\n     * @param mixed $site\r\n     * @return Site\r\n     */\r\n    public function setSite($site)\r\n    {\r\n        $this->site = $site;\r\n        return $this;\r\n    }\r\n}\r\n\r\n´´´\r\n\r\nAnd this is my configuration :\r\n\r\n```\r\neasy_admin:\r\n    entities:\r\n        Country:\r\n            class: AppBundle\\Entity\\Country\r\n            label: 'Country'\r\n            list:\r\n                title: 'Country %%entity_label%%'\r\n                actions:\r\n                    - { name: 'edit', label: '', icon: 'edit' }\r\n                    - { name: 'delete', label: '', icon: 'trash' }\r\n                fields:\r\n                    - 'id'\r\n                    - { property: 'name', label: 'Label' }\r\n                    - 'value'\r\n                    - 'site'\r\n            form:\r\n                fields:\r\n                    - { type: 'group', css_class: 'col-sm-4' }\r\n                    - { property: 'name', label: 'Label', css_class: 'large', help: 'The name of the country' }\r\n                    - { property: 'value', type: 'text', label: 'Value'}\r\n                    - { property: 'site', type_options: { by_reference: false } }\r\n\r\neasy_admin:\r\n    entities:\r\n        Site:\r\n            class: AppBundle\\Entity\\Site\r\n            label: 'Site'\r\n´´´\r\n\r\nIf I try to update changing  the site children of a country directly from the country view it doesn't work.\r\n\r\nSomeone can help me please?\r\n\r\nThank you, regards\r\n\r\n\r\n"}}
{"actor":{"display_login":"alexcandy91"}}