protected function ResourceFieldEntityReference::referencedId in RESTful 7.2
Helper function to get the referenced entity ID.
Parameters
\EntityDrupalWrapper $property_wrapper: The wrapper for the referenced entity.
Return value
mixed The ID.
Overrides ResourceFieldEntity::referencedId
1 call to ResourceFieldEntityReference::referencedId()
- ResourceFieldEntityReference::value in src/
Plugin/ resource/ Field/ ResourceFieldEntityReference.php - Gets the value for the field given a data source.
1 method overrides ResourceFieldEntityReference::referencedId()
- ResourceFieldFileEntityReference::referencedId in src/
Plugin/ resource/ Field/ ResourceFieldFileEntityReference.php - Helper function to get the referenced entity ID.
File
- src/
Plugin/ resource/ Field/ ResourceFieldEntityReference.php, line 233 - Contains \Drupal\restful\Plugin\resource\Field\ResourceFieldEntityReference.
Class
- ResourceFieldEntityReference
- Class ResourceFieldEntityReference.
Namespace
Drupal\restful\Plugin\resource\FieldCode
protected function referencedId($property_wrapper) {
$identifier = $property_wrapper
->getIdentifier();
if (!$this->referencedIdProperty) {
return $identifier;
}
try {
return $identifier ? $property_wrapper->{$this->referencedIdProperty}
->value() : NULL;
} catch (\EntityMetadataWrapperException $e) {
// An exception will be raised for broken entity reference fields.
return NULL;
}
}