/**
* {@inheritdoc}
*/
protected function doCreate(array
$values) { $bundle =
$this->
getBundleFromValues($values);
if ($this->bundleKey && !
$bundle) { throw new EntityStorageException('Missing bundle for entity type ' .
$this->entityTypeId
);
} $entity_class =
$this->
getEntityClass($bundle);
$entity =
new $entity_class([],
$this->entityTypeId,
$bundle);
$this->
initFieldValues($entity,
$values);
return $entity;
} /**
* {@inheritdoc}
*/
public function getBundleFromClass(string
$class_name): ?string
{ $bundle_for_class = NULL;
foreach ($this->entityTypeBundleInfo->
getBundleInfo($this->entityTypeId
) as $bundle =>
$bundle_info) { if (!
empty($bundle_info['class'
]) &&
$bundle_info['class'
] ===
$class_name) {