Mercurial > hg > isophonics-drupal-site
comparison core/modules/serialization/src/EntityResolver/EntityResolverInterface.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\serialization\EntityResolver; | |
4 | |
5 use Symfony\Component\Serializer\Normalizer\NormalizerInterface; | |
6 | |
7 interface EntityResolverInterface { | |
8 | |
9 /** | |
10 * Returns the local ID of an entity referenced by serialized data. | |
11 * | |
12 * Drupal entities are loaded by and internally referenced by a local ID. | |
13 * Because different websites can use the same local ID to refer to different | |
14 * entities (e.g., node "1" can be a different node on foo.com and bar.com, or | |
15 * on example.com and staging.example.com), it is generally unsuitable for use | |
16 * in hypermedia data exchanges. Instead, UUIDs, URIs, or other globally | |
17 * unique IDs are preferred. | |
18 * | |
19 * This function takes a $data array representing partially deserialized data | |
20 * for an entity reference, and resolves it to a local entity ID. For example, | |
21 * depending on the data specification being used, $data might contain a | |
22 * 'uuid' key, a 'uri' key, a 'href' key, or some other data identifying the | |
23 * entity, and it is up to the implementor of this interface to resolve that | |
24 * appropriately for the specification being used. | |
25 * | |
26 * @param \Symfony\Component\Serializer\Normalizer\NormalizerInterface $normalizer | |
27 * The Normalizer which is handling the data. | |
28 * @param array $data | |
29 * The data passed into the calling Normalizer. | |
30 * @param string $entity_type | |
31 * The type of entity being resolved; e.g., 'node' or 'user'. | |
32 * | |
33 * @return string|null | |
34 * Returns the local entity ID, if found. Otherwise, returns NULL. | |
35 */ | |
36 public function resolve(NormalizerInterface $normalizer, $data, $entity_type); | |
37 | |
38 } |