2

I tried to search through a number of forum and google along, but I did not find any solution, yet.

I would like to implement on my drupal 7 site a set of entities related each other as you would do in a standard sql db:

I created three entities: person, city, country

The entity city has a field referenced to the entity country (using entity reference module). The entity person has a field referenced to the entity city. I'm able now to create a person and select a city after I've selected the country (thanks to the entity relations).

I filled in some countries, cities and persons.

When I deleted (not for intention) a city that is used (related to) by many persons I discovered that Drupal deleted the city entity without warning me that som persons are related to such city. The persons related to such city, kept on existing with the field city set as blank...

I though entity relations could have a behaviour just like sql db, where there is integrity reference consistency (you cannot delete items in table if they're referenced as foreign key in another table)

Is there a way to prevent deletion of entities that are referenced by other entities?

closed as too broad by kiamlaluno Oct 16 '15 at 3:48

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.