protected function EntityCreationTrait::modifyCreatedEntity in JSON:API Resources 8
Modifies the created entity before it is saved.
This method can be overridden so that custom JSON:API resources can modify the created entity before it is saved.
Classes overriding this method have access to the same arguments as a JSON:API resource's process() method by calling $request->arguments->get($arg_name).
Parameters
\Drupal\Core\Entity\EntityInterface $created_entity: The created entity.
\Symfony\Component\HttpFoundation\Request $request: The request object.
1 call to EntityCreationTrait::modifyCreatedEntity()
- EntityCreationTrait::processEntityCreation in src/
Unstable/ Entity/ EntityCreationTrait.php - Process the resource request.
2 methods override EntityCreationTrait::modifyCreatedEntity()
- AddComment::modifyCreatedEntity in tests/
modules/ jsonapi_resources_test/ src/ Resource/ AddComment.php - Modifies the created entity before it is saved.
- AddReminder::modifyCreatedEntity in tests/
modules/ jsonapi_resources_test/ src/ Resource/ AddReminder.php - Modifies the created entity before it is saved.
File
- src/
Unstable/ Entity/ EntityCreationTrait.php, line 110
Class
- EntityCreationTrait
- Provides methods for handling POST requests that should create an entity.
Namespace
Drupal\jsonapi_resources\Unstable\EntityCode
protected function modifyCreatedEntity(EntityInterface $created_entity, Request $request) {
// no-op.
}