yep @yannickroger, i was wrong now. the whole thing is a bit confusing to me. I've been thinking on it and now, i think we have things in ezcontentobjectattribute that should be moved to ezcontentclassattribute instead. 

Here's another aproach and please correct me if i'm wrong. 

When you delete an attribute i think https://github.com/ezsystems/ezpublish-legacy/blob/ezp-22923-delete_attribute_links/kernel/classes/ezcontentclassattribute.php#L356 
is called at some point right?

Knowing that and that this function calls (*) https://github.com/ezsystems/ezpublish-legacy/blob/ezp-22923-delete_attribute_links/kernel/classes/ezcontentclassattribute.php#L365, then probably we can just add deleteStoredClassAttribute functions to objectrelation and objectrelationlist datatype classes... Thoughts?

I added the (*) cause there is a condition there 
https://github.com/ezsystems/ezpublish-legacy/blob/ezp-22923-delete_attribute_links/kernel/classes/ezcontentclassattribute.php#L359
and i don't really know what role plays there...