Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

TargetIdResolver.php

Namespace

Drupal\serialization\EntityResolver

File

core/modules/serialization/src/EntityResolver/TargetIdResolver.php

View source
<?php

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;
    }

}

Classes

Title Deprecated Summary
TargetIdResolver Resolves entities from data that contains an entity target ID.
RSS feed
Powered by Drupal