CivicrmEntityStorageSchema.php in CiviCRM Entity 8.3
File
src/Entity/Sql/CivicrmEntityStorageSchema.php
View source
<?php
namespace Drupal\civicrm_entity\Entity\Sql;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
class CivicrmEntityStorageSchema extends SqlContentEntityStorageSchema {
protected $storage;
public function onEntityTypeCreate(EntityTypeInterface $entity_type) {
$this
->checkEntityType($entity_type);
$table_mapping = $this->storage
->getTableMapping();
foreach ($this->fieldStorageDefinitions as $field_storage_definition) {
if ($table_mapping
->requiresDedicatedTableStorage($field_storage_definition)) {
$this
->createDedicatedTableSchema($field_storage_definition);
}
}
}
public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original) {
$this
->checkEntityType($entity_type);
$this
->checkEntityType($original);
}
public function requiresEntityStorageSchemaChanges(EntityTypeInterface $entity_type, EntityTypeInterface $original) {
return FALSE;
}
public function requiresFieldStorageSchemaChanges(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original) {
return FALSE;
}
}