You are here

protected function ReferenceStorage::saveToDedicatedTables in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/src/ReferenceStorage.php \Drupal\bibcite_entity\ReferenceStorage::saveToDedicatedTables()

Saves values of fields that use dedicated tables.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity.

bool $update: TRUE if the entity is being updated, FALSE if it is being inserted.

string[] $names: (optional) The names of the fields to be stored. Defaults to all the available fields.

Overrides SqlContentEntityStorage::saveToDedicatedTables

File

modules/bibcite_entity/src/ReferenceStorage.php, line 17

Class

ReferenceStorage
Defines a Controller class for reference items.

Namespace

Drupal\bibcite_entity

Code

protected function saveToDedicatedTables(ContentEntityInterface $entity, $update = TRUE, $names = []) {
  $citekey = NULL;

  /** @var \Drupal\bibcite_entity\Entity\Reference $entity */
  if ($citekey_item = $entity
    ->get('bibcite_citekey')
    ->get(0)) {
    $citekey = $citekey_item
      ->getValue();
  }
  if (!$citekey && $entity
    ->isNew()) {
    $entity->bibcite_citekey = $entity
      ->generateCitekey();
  }
  return parent::saveToDedicatedTables($entity, $update, $names);
}