Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291835

check that id does not exist before saving a new ConfigEntity

$
0
0

Drupal\field\Plugin\Core\Entity\FieldInstance::saveNew() has code to check that an instance for that field doesn't already exist for that entiy_type+bundle (and raise an exception if that's already the case)

In practice, this just means checking that an configEntity with the same id doesn't already exist.
That is, prevent someone from doing :

entity_create('field_instance', $array)  // where $array points to an already existing FieldInstance in the current active config
  ->save();           // Overrides the FieldInstance that was already there, goodbye...

There's no real reason why this check would make sense for FieldInstance config entities only. This should be checked automatically for all config entities


Viewing all articles
Browse latest Browse all 291835

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>