Drupal 8  8.0.2
EntityResource Class Reference
Inheritance diagram for EntityResource:

Public Member Functions

 get (EntityInterface $entity)
 
 post (EntityInterface $entity=NULL)
 
 patch (EntityInterface $original_entity, EntityInterface $entity=NULL)
 
 delete (EntityInterface $entity)
 
- Public Member Functions inherited from ResourceBase
 __construct (array $configuration, $plugin_id, $plugin_definition, array $serializer_formats, LoggerInterface $logger)
 
 permissions ()
 
 routes ()
 
 availableMethods ()
 
- Public Member Functions inherited from PluginInspectionInterface
 getPluginId ()
 
 getPluginDefinition ()
 

Protected Member Functions

 validate (EntityInterface $entity)
 
 getBaseRoute ($canonical_path, $method)
 
- Protected Member Functions inherited from ResourceBase
 requestMethods ()
 
 getBaseRoute ($canonical_path, $method)
 

Additional Inherited Members

- Static Public Member Functions inherited from ResourceBase
static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 
- Protected Attributes inherited from ResourceBase
 $serializerFormats = array()
 
 $logger
 

Detailed Description

Represents entities as resources.

( id = "entity", label = ("Entity"), serialization_class = "Drupal\Core\Entity\Entity", deriver = "Drupal\rest\Plugin\Deriver\EntityDeriver", uri_paths = { "canonical" = "/entity/{entity_type}/{entity}", "https://www.drupal.org/link-relations/create" = "/entity/{entity_type}" } )

See Also

Member Function Documentation

delete ( EntityInterface  $entity)

Responds to entity DELETE requests.

Parameters
\Drupal\Core\Entity\EntityInterface$entityThe entity object.
Returns
The HTTP response object.
Exceptions
\Symfony\Component\HttpKernel\Exception\HttpException

References Drupal\logger().

Here is the call graph for this function:

get ( EntityInterface  $entity)

Responds to entity GET requests.

Parameters
\Drupal\Core\Entity\EntityInterface$entityThe entity object.
Returns
The response containing the entity with its accessible fields.
Exceptions
\Symfony\Component\HttpKernel\Exception\HttpException
getBaseRoute (   $canonical_path,
  $method 
)
protected

{}

patch ( EntityInterface  $original_entity,
EntityInterface  $entity = NULL 
)

Responds to entity PATCH requests.

Parameters
\Drupal\Core\Entity\EntityInterface$original_entityThe original entity object.
\Drupal\Core\Entity\EntityInterface$entityThe entity.
Returns
The HTTP response object.
Exceptions
\Symfony\Component\HttpKernel\Exception\HttpException

References AccessibleInterface\access(), EntityInterface\getEntityTypeId(), EntityInterface\id(), Drupal\logger(), and EntityInterface\save().

Here is the call graph for this function:

post ( EntityInterface  $entity = NULL)

Responds to entity POST requests and saves the new entity.

Parameters
\Drupal\Core\Entity\EntityInterface$entityThe entity.
Returns
The HTTP response object.
Exceptions
\Symfony\Component\HttpKernel\Exception\HttpException

References Drupal\logger().

Here is the call graph for this function:

validate ( EntityInterface  $entity)
protected

Verifies that the whole entity does not violate any validation constraints.

Parameters
\Drupal\Core\Entity\EntityInterface$entityThe entity object.
Exceptions
\Symfony\Component\HttpKernel\Exception\HttpExceptionIf validation errors are found.

The documentation for this class was generated from the following file: