Use ReferenceIntegrity behavior for Doctrine ODM
mainThe ReferenceIntegrity behavior automates reference integrity for referenced documents in Doctrine MongoDB ODM. It ensures that when a document is deleted, its references in other documents are handled according to a specified strategy.
Supported strategies:
nullify: Automatically removes the reference (sets it to null) in the referenced document.pull: When used on aReferenceManyassociation, the removed document is automatically pulled from the collection array.restrict: Throws aReferenceIntegrityStrictExceptionif the document is still being referenced.
Requirements:
- This is an ODM only extension.
- You must have the
mappedByoption set on the association to allow the extension to access and update the referenced documents.