You are here

public function CerFieldHandler::add in Corresponding Entity References 7.3

Adds a reference to $entity, validating it first.

Parameters

EntityDrupalWrapper $entity: The wrapped entity to reference.

File

includes/CerFieldHandler.inc, line 56
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

public function add(EntityDrupalWrapper $entity) {
  if ($this
    ->validate($entity)) {
    $this
      ->write();
  }
}