ezsystems/ezpublish-kernel — pull request #993 by pspanja (2014-09-15 16:31:50+00:00)
Title: Fix EZP-22408: Deleting a content does not remove references to this content in relation(list) fields

This PR resolves issue https://jira.ez.no/browse/EZP-22408 and is continuation of https://github.com/ezsystems/ezpublish-kernel/pull/750

Relation and RelationList fieldtypes store relation data in the field values. When Content is deleted these values (of the Content reversely related through the FIELD type relation to the deleted Content) needs to be updated.
LS handles this through eZDataType::fixRelatedObjectItem() method, which datatypes need to implement as needed (in LS only `ezcontentobjectrelationlist` implements it). However in the new stack we do not have any kind of standard mechanism that would handle this kind of update, and it should probably stay that way, as we have SPI cache in place and don't even map this data to the fieldtype Value objects.

For this reason the cleanup is implemented in the Content Gateway, for Relation and RelationList fieldtypes values specifically.
No checking of consistency is performed in field value converters, as the cleanup script is provided and LS does not do this either.

Also, Cache storage is updated to clear cache of reversely field related Content in ContentHandler::deleteContent().