I have problem with my phpcr document.
I try to implement, upload file like http://symfony.com/doc/current/cookbook/doctrine/file_uploads.html but I have problem with file changing.
It look like sf2 doesn't see any changes. When I changed (for example) name field and photo it's ok, but if I changed photo only I haven't any changes.
My code : Document ( entity )
/**
* @PHPCR\String
*/
protected $image;
/**
* @Assert\File(maxSize="6000000")
*/
private $file = null;
/**
* @PHPCR\PrePersist()
* @PHPCR\PreUpdate()
*/
public function preUpload()
{
if (null !== $this->getFile()) {
$this->setImage(sha1(uniqid(mt_rand(), true)).'.jpg');
}
}
/**
* @PHPCR\PostPersist()
* @PHPCR\PostUpdate()
*/
public function upload()
{
if (null === $this->getFile()) {
return;
}
$this->getFile()->move(
$this->getUploadRootDir(),
$this->getImage()
);
$this->file = null;
}
Summarizing: If I change file only LiveCycle ( preUpdate and postUpdate ) doesn't work.