You are here

protected function CerFieldHandler::write in Corresponding Entity References 7.3

Saves changes to the entity and resets the iterator.

2 calls to CerFieldHandler::write()
CerFieldHandler::add in includes/CerFieldHandler.inc
Adds a reference to $entity, validating it first.
CerFieldHandler::delete in includes/CerFieldHandler.inc
Deletes all references to $entity.

File

includes/CerFieldHandler.inc, line 154
Contains CerFieldHandler.

Class

CerFieldHandler
@class Handles low-level operations for a single field on a single entity. Exposes methods to add, delete and check for references. This will also iterate over the references, returning each one as an EntityDrupalWrapper object.

Code

protected function write() {
  $entity_type = $this->entity
    ->type();
  $entityID = $this->entity
    ->getIdentifier();
  $entity = $this->entity
    ->value();
  $entity->cer_processed = TRUE;
  entity_save($entity_type, $entity);

  // Reload the entity we just saved and cleared from the static cache.
  $entities = entity_load($entity_type, (array) $entityID);
  $this->entity
    ->set($entities[$entityID]);
  $this
    ->__construct($this->field, $this->entity);
}