Actions
Bug #72613
closedExtbase does not delete 1:1 related objects with @cascade remove
Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2016-01-09
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
4.7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
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:
Actions