{"action":"opened","issue":{"url":"https://api.github.com/repos/dustin10/VichUploaderBundle/issues/840","repository_url":"https://api.github.com/repos/dustin10/VichUploaderBundle","labels_url":"https://api.github.com/repos/dustin10/VichUploaderBundle/issues/840/labels{/name}","comments_url":"https://api.github.com/repos/dustin10/VichUploaderBundle/issues/840/comments","events_url":"https://api.github.com/repos/dustin10/VichUploaderBundle/issues/840/events","html_url":"https://github.com/dustin10/VichUploaderBundle/issues/840","id":297041738,"number":840,"title":"Images are physically deleted after updating collection entity document","user":{"login":"velkony","id":8723676,"avatar_url":"https://avatars0.githubusercontent.com/u/8723676?v=4","gravatar_id":"","url":"https://api.github.com/users/velkony","html_url":"https://github.com/velkony","followers_url":"https://api.github.com/users/velkony/followers","following_url":"https://api.github.com/users/velkony/following{/other_user}","gists_url":"https://api.github.com/users/velkony/gists{/gist_id}","starred_url":"https://api.github.com/users/velkony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/velkony/subscriptions","organizations_url":"https://api.github.com/users/velkony/orgs","repos_url":"https://api.github.com/users/velkony/repos","events_url":"https://api.github.com/users/velkony/events{/privacy}","received_events_url":"https://api.github.com/users/velkony/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-14T10:20:53Z","updated_at":"2018-02-14T10:20:53Z","closed_at":null,"author_association":"NONE","body":"Images are physically deleted after updating collection entity document.\r\nI saw that such a question was discussed here, but not for ODM.\r\n\r\nI use S4 with vich/uploader-bundle - 1.8 and ODM.\r\nЕverything works normally with a relation @MongoDB\\EmbedOne, but when I want to use a collection I noticed the following bug.\r\n\r\n```\r\nclass Main {\r\n.....\r\n\r\n/**\r\n* @MongoDB\\EmbedMany(targetDocument=\"App\\Document\\MainPage\\MoreFields\", strategy=\"setArray\")\r\n*/\r\n    private $moreFields;\r\n// ..... other fields\r\n\r\n=============================================================================================\r\n/**\r\n * @MongoDB\\EmbeddedDocument\r\n */\r\nclass MoreFields\r\n{\r\n\r\n/**\r\n* @MongoDB\\EmbedOne(targetDocument=\"App\\Document\\ImageDocument\")\r\n*/\r\n     private $mainImage;\r\n// ..... other fields\r\n\r\n=============================================================================================\r\n/**\r\n * @MongoDB\\EmbeddedDocument\r\n * @Vich\\Uploadable\r\n */\r\nclass ImageDocument\r\n{\r\n// ..... other fields\r\n\r\n /**\r\n     * @MongoDB\\Field(type=\"string\")\r\n     */\r\n    protected $originalName;\r\n\r\n    /**\r\n     * @Vich\\UploadableField(mapping=\"settings_image\", fileNameProperty=\"imageName\")\r\n     *\r\n     * @var File $imageFile\r\n     */\r\n    protected $imageFile;\r\n\r\n    /**\r\n     * @MongoDB\\Field(type=\"string\", name=\"image_name\", nullable=true)\r\n     */\r\n    protected $imageName;\r\n\r\n    /**\r\n     * @MongoDB\\Field(type=\"date\")\r\n     */\r\n    protected $updatedAt;\r\n\r\n    /**\r\n     * @MongoDB\\Field(type=\"string\", name=\"image_alt\", nullable=true)\r\n     */\r\n    protected $imageAlt;\r\n\r\n    /**\r\n     *\r\n     * @param File|\\Symfony\\Component\\HttpFoundation\\File\\UploadedFile $image\r\n     */\r\n    public function setImageFile(File $image = null)\r\n    {\r\n        $this->imageFile = $image;\r\n\r\n        if ($image) {\r\n            $this->updatedAt = new \\DateTime('now');\r\n        }\r\n```\r\nI tried the option to add a text field but without result\r\nThe collection rest in the database but the image is physically deleted."}}
{"actor":{"display_login":"velkony"}}