You are here

public function ResourceFieldEntity::set in RESTful 7.2

Gets the value for the field given a data source.

Parameters

mixed $value: The value for the field.

DataInterpreterInterface $interpreter: The data source object. Interacts with the data storage.

Throws

IncompatibleFieldDefinitionException

Overrides ResourceFieldInterface::set

File

src/Plugin/resource/Field/ResourceFieldEntity.php, line 276
Contains \Drupal\restful\Plugin\resource\Field\ResourceFieldEntity

Class

ResourceFieldEntity
Class ResourceFieldEntity.

Namespace

Drupal\restful\Plugin\resource\Field

Code

public function set($value, DataInterpreterInterface $interpreter) {
  try {
    $property_wrapper = $interpreter
      ->getWrapper()->{$this
      ->getProperty()};
    $property_wrapper
      ->set($value);
  } catch (\Exception $e) {
    $this->decorated
      ->set($value, $interpreter);
  }
}