Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176
This commit is contained in:
commit
9921556621
13277 changed files with 1459781 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\serialization\EntityResolver\TargetIdResolver.
|
||||
*/
|
||||
|
||||
namespace Drupal\serialization\EntityResolver;
|
||||
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
/**
|
||||
* Resolves entities from data that contains an entity target ID.
|
||||
*/
|
||||
class TargetIdResolver implements EntityResolverInterface {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function resolve(NormalizerInterface $normalizer, $data, $entity_type) {
|
||||
if (isset($data['target_id'])) {
|
||||
return $data['target_id'];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in a new issue