#72613Extbase does not delete 1:1 related objects with @cascade remove
Description
given following model (simplified) with @cascade annotation:
class Model {
/**
* Address
*
* @var Address
* @lazy
* @cascade remove
*/
protected $address;
/**
* Deletes the address
*/
public function unsetAddress() {
$this->address = null;
}
}
when I call in my controller:
$this->model->unsetAddress(); $this->modelRepository->update($this->model);
I would expect that the related Address will also get deleted but instead just the address property of Model will bet set NULL in database.
As a manual workaround I currently have to add the following code:
if ($model->getAddress()) {
$this->addressRepository->remove($model->getAddress());
}
It seeams like the @cascade remove annotation is only considered for ObjectStorage:
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.