I had a problem with my custom model’s repository.
I have a model with an avatar (Image), with a simple OneToOne relation:
* @var Image
Now, imagine I have an instantance of this model which I want to get rid of its avatar, so I simply do
I then get the following error:
An exception occurred while executing ‘INSERT INTO neos_flow_resourcemanagement_persistentresource (persistence_object_identifier, collectionname, filename, filesize, relativepublicationpath, mediatype, sha1, md5) VALUES (?, ?, ?, ?, ?, ?, ?, ?)’: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound
This means that my repository is trying to insert null in place of an Image. How can I implicitly tell doctrine to not do that for Null values ? I’d expect this to be default behaviour, or is there another way to “break” a relation in such cases ? I tried to do
unset($this->avatar) instead of using
setAvatar without success either.