You are here

protected function CourseObjectStorage::doCreate in Course 8.3

Same name and namespace in other branches
  1. 8.2 src/Storage/CourseObjectStorage.php \Drupal\course\Storage\CourseObjectStorage::doCreate()
  2. 3.x src/Storage/CourseObjectStorage.php \Drupal\course\Storage\CourseObjectStorage::doCreate()

When creating a new entity, map any object to its respective class.

Overrides ContentEntityStorageBase::doCreate

File

src/Storage/CourseObjectStorage.php, line 15

Class

CourseObjectStorage

Namespace

Drupal\course\Storage

Code

protected function doCreate(array $values) {
  $available = course_get_handlers();
  $ret = $available[$values['object_type']];
  if ($ret['class']) {
    $this->entityClass = $ret['class'];
  }
  else {
    $this->entityClass = 'Drupal\\course\\Course\\Object\\CourseObjectBroken';
  }
  return parent::doCreate($values);
}