protected function ResourceFieldEntity::propertyOnEntity in RESTful 7.2
Sets the resource field property to the schema field in the entity.
Throws
\EntityMetadataWrapperException
1 call to ResourceFieldEntity::propertyOnEntity()
- ResourceFieldEntity::addDefaults in src/Plugin/ resource/ Field/ ResourceFieldEntity.php 
- Almost all the defaults come are applied by the object's property defaults.
File
- src/Plugin/ resource/ Field/ ResourceFieldEntity.php, line 1149 
- Contains \Drupal\restful\Plugin\resource\Field\ResourceFieldEntity
Class
- ResourceFieldEntity
- Class ResourceFieldEntity.
Namespace
Drupal\restful\Plugin\resource\FieldCode
protected function propertyOnEntity() {
  // If there is no property try to get it based on the wrapper method and
  // store the value in the decorated object.
  $property = NULL;
  $wrapper_method = $this
    ->getWrapperMethod();
  $wrapper = $this
    ->entityTypeWrapper();
  if ($wrapper_method == 'label') {
    // Store the label key.
    $property = $wrapper
      ->entityKey('label');
  }
  elseif ($wrapper_method == 'getBundle') {
    // Store the bundle key.
    $property = $wrapper
      ->entityKey('bundle');
  }
  elseif ($wrapper_method == 'getIdentifier') {
    // Store the ID key.
    $property = $wrapper
      ->entityKey('id');
  }
  // There are occasions when the wrapper property is not the schema
  // database field.
  if (!is_a($wrapper, '\\EntityStructureWrapper')) {
    // The entity type does not exist.
    return;
  }
  /* @var $wrapper \EntityStructureWrapper */
  foreach ($wrapper
    ->getPropertyInfo() as $wrapper_property => $property_info) {
    if (!empty($property_info['schema field']) && $property_info['schema field'] == $property) {
      $property = $wrapper_property;
      break;
    }
  }
  $this
    ->setProperty($property);
}