function CollectResourceObjectMetaEvent::__construct
Constructs a new CollectResourceObjectMetaEvent object.
Parameters
\Drupal\jsonapi\JsonApiResource\ResourceObject $resourceObject: The resource object.
array $context: The context options for the normalizer.
File
-
core/
modules/ jsonapi/ src/ Events/ CollectResourceObjectMetaEvent.php, line 41
Class
- CollectResourceObjectMetaEvent
- Event for collecting resource object metadata of a JSON:API resource types.
Namespace
Drupal\jsonapi\EventsCode
public function __construct(ResourceObject $resourceObject, array $context) {
if (empty($context['resource_object']) || !$context['resource_object'] instanceof ResourceObject || $this->context['resource_object']
->getId() !== $this->resourceObject
->getId()) {
throw new \RuntimeException('The context must contain a valid resource object.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.