1

My Article Entity has collection $internalAuthors

/**
 * @ORM\OneToMany(targetEntity = "ArticleModule\Model\Entities\ArticleInternalAuthor", mappedBy = "article", cascade = {"persist"})
 */
protected $internalAuthors;

If I want to clear this collection ($this->internalAuthors->clear()), collection is cleared, but data are still in database.

I must call DQL for delete that authors from database. But I prefer have this kind of logic in entity. I noticed, if I add orphanRemoval = TRUE, to OneToMany declaration, then data are removed also from database.

Is it correct usage of orphanRemoval? Should I use something else?

0 Answers0