From c13cc9e0958af920e78965b1ca8610c5b27919cc Mon Sep 17 00:00:00 2001 From: Philipp Hoffmann Date: Sat, 20 Oct 2012 14:04:31 +0300 Subject: [PATCH] fixed file property accessibility The file property should be private and there should be a setter for the property (so the form can save it). Otherwise doctrine complains about the public property: Field 'file' in class 'Acme\DemoBundle\Entity\Document' must be private or protected. Public fields may break lazy-loading. --- cookbook/doctrine/file_uploads.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cookbook/doctrine/file_uploads.rst b/cookbook/doctrine/file_uploads.rst index 71111b5fe28..309e15676b1 100644 --- a/cookbook/doctrine/file_uploads.rst +++ b/cookbook/doctrine/file_uploads.rst @@ -122,9 +122,14 @@ rules:: /** * @Assert\File(maxSize="6000000") */ - public $file; + private $file; // ... + + public function setFile($file) + { + $this->file = $file; + } } .. note::