checkEntityType example

/** * {@inheritdoc} */
  public function onEntityTypeCreate(EntityTypeInterface $entity_type) {
    $this->onFieldableEntityTypeCreate($entity_type$this->entityFieldManager->getFieldStorageDefinitions($entity_type->id()));
  }

  /** * {@inheritdoc} */
  public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original) {
    $this->checkEntityType($entity_type);
    $this->checkEntityType($original);

    // If no schema changes are needed, we don't need to do anything.     if (!$this->requiresEntityStorageSchemaChanges($entity_type$original)) {
      return;
    }

    // If shared table schema changes are needed, we can't proceed.     if (!class_exists($original->getStorageClass()) || $this->hasSharedTableStructureChange($entity_type$original)) {
      throw new EntityStorageException('It is not possible to change the entity type schema outside of a batch context. Use EntityDefinitionUpdateManagerInterface::updateFieldableEntityType() instead.');
    }

    
Home | Imprint | This part of the site doesn't use cookies.