Using Entity API, I can create entities easily like this:
// SomeEntity class extends ContentEntityBase $entity = SomeEntity::create(['my_id' => 'id123']); $entity->save();
Works fine as long as
my_id is unique. When it's not, I get
EntityStorageException with message complaining about
my_id not being unique. I could first try to load entity to see if it exists and update it manually but that seems like unnecessary overhead.
Is there a way to automatically save or update existing entity programatically?