{"action":"created","issue":{"url":"https://api.github.com/repos/vitiko/IphpFileStoreBundle/issues/25","labels_url":"https://api.github.com/repos/vitiko/IphpFileStoreBundle/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/vitiko/IphpFileStoreBundle/issues/25/comments","events_url":"https://api.github.com/repos/vitiko/IphpFileStoreBundle/issues/25/events","html_url":"https://github.com/vitiko/IphpFileStoreBundle/issues/25","id":42519158,"number":25,"title":"File does not remove from sonata_type_collection","user":{"login":"rifats","id":7238962,"avatar_url":"https://avatars.githubusercontent.com/u/7238962?v=3","gravatar_id":"","url":"https://api.github.com/users/rifats","html_url":"https://github.com/rifats","followers_url":"https://api.github.com/users/rifats/followers","following_url":"https://api.github.com/users/rifats/following{/other_user}","gists_url":"https://api.github.com/users/rifats/gists{/gist_id}","starred_url":"https://api.github.com/users/rifats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rifats/subscriptions","organizations_url":"https://api.github.com/users/rifats/orgs","repos_url":"https://api.github.com/users/rifats/repos","events_url":"https://api.github.com/users/rifats/events{/privacy}","received_events_url":"https://api.github.com/users/rifats/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-09-11T12:40:27Z","updated_at":"2015-03-09T21:41:30Z","closed_at":null,"body":"File is not deleted when you edit through sonata_type_collection.\r\n->add('portraits', \"sonata_type_collection\",\r\n                    array(\r\n                        'label' => false,\r\n                        'required' => false,\r\n                        'by_reference' => false,\r\n                        'data_class' => null\r\n                    ),\r\n                    array(\r\n                        'edit' => 'inline',\r\n                        'inline' => 'table',\r\n                        'allow_add'      => true,\r\n                        'allow_delete'   => true\r\n                    )\r\n                )\r\nThe record is deleted, but the file is no.\r\n"},"comment":{"url":"https://api.github.com/repos/vitiko/IphpFileStoreBundle/issues/comments/77949300","html_url":"https://github.com/vitiko/IphpFileStoreBundle/issues/25#issuecomment-77949300","issue_url":"https://api.github.com/repos/vitiko/IphpFileStoreBundle/issues/25","id":77949300,"user":{"login":"WarGot-by","id":4224186,"avatar_url":"https://avatars.githubusercontent.com/u/4224186?v=3","gravatar_id":"","url":"https://api.github.com/users/WarGot-by","html_url":"https://github.com/WarGot-by","followers_url":"https://api.github.com/users/WarGot-by/followers","following_url":"https://api.github.com/users/WarGot-by/following{/other_user}","gists_url":"https://api.github.com/users/WarGot-by/gists{/gist_id}","starred_url":"https://api.github.com/users/WarGot-by/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WarGot-by/subscriptions","organizations_url":"https://api.github.com/users/WarGot-by/orgs","repos_url":"https://api.github.com/users/WarGot-by/repos","events_url":"https://api.github.com/users/WarGot-by/events{/privacy}","received_events_url":"https://api.github.com/users/WarGot-by/received_events","type":"User","site_admin":false},"created_at":"2015-03-09T21:41:30Z","updated_at":"2015-03-09T21:41:30Z","body":"Maybe you should use  **orphanRemoval=true**\r\nExample \r\n```php\r\n<?php\r\n\r\nnamespace True\\VnsBundle\\Entity;\r\n\r\nuse Doctrine\\Common\\Collections\\ArrayCollection;\r\nuse Doctrine\\ORM\\Mapping as ORM;\r\n\r\n/**\r\n * Main\r\n *\r\n * @ORM\\Table(name=\"main\", indexes={@ORM\\Index(name=\"name_org\", columns={\"name_org\"})})\r\n * @ORM\\Entity\r\n * @ORM\\Entity(repositoryClass=\"True\\VnsBundle\\Entity\\MainRepository\")\r\n */\r\nclass Main\r\n{\r\n    /**\r\n     * Company employees\r\n     * @ORM\\OneToMany(targetEntity=\"\\True\\VnsBundle\\Entity\\Empl\", mappedBy=\"company\",cascade={\"persist\"}, **orphanRemoval=true**)\r\n     **/\r\n    protected $empl;\r\n}\r\n```\r\n```php\r\n<?php\r\n\r\nnamespace True\\VnsBundle\\Entity;\r\n\r\nuse Doctrine\\ORM\\Mapping as ORM;\r\n\r\n/**\r\n * Empl\r\n *\r\n * @ORM\\Table(name=\"empl\")\r\n * @ORM\\Entity\r\n */\r\nclass Empl\r\n{\r\n    /**\r\n     * Employee company\r\n     * @ORM\\ManyToOne(targetEntity=\"\\True\\VnsBundle\\Entity\\Main\", inversedBy=\"empl\")\r\n     * @ORM\\JoinColumn(name=\"company_id\", referencedColumnName=\"id\",  nullable=true)\r\n     */\r\n    private $company;\r\n}\r\n```"}}