You are here

public function EntityAPIControllerExportable::save in Entity API 7

Overridden to care exportables that are overridden.

Overrides EntityAPIController::save

File

includes/entity.controller.inc, line 948
Provides a controller building upon the core controller but providing more features like full CRUD functionality.

Class

EntityAPIControllerExportable
A controller implementing exportables stored in the database.

Code

public function save($entity, DatabaseTransaction $transaction = NULL) {

  // Preload $entity->original by name key if necessary.
  if (!empty($entity->{$this->nameKey}) && empty($entity->{$this->idKey}) && !isset($entity->original)) {
    $entity->original = entity_load_unchanged($this->entityType, $entity->{$this->nameKey});
  }

  // Update the status for entities getting overridden.
  if (entity_has_status($this->entityType, $entity, ENTITY_IN_CODE) && empty($entity->is_rebuild)) {
    $entity->{$this->statusKey} |= ENTITY_CUSTOM;
  }
  return parent::save($entity, $transaction);
}