FileUpload
class FileUpload (View source)
| internal | JSON:API maintains no PHP API. The API is the HTTP API. This class may change at any time and could break any dependencies on it. |
Handles file upload requests.
Traits
Provides a method to validate an entity.
Properties
| protected AccountInterface | $currentUser | The current user making the request. |
|
| protected EntityFieldManagerInterface | $fieldManager | The field manager. |
|
| protected TemporaryJsonapiFileFieldUploader | $fileUploader | The file uploader. |
|
| protected HttpKernelInterface | $httpKernel | An HTTP kernel for making subrequests. |
Methods
Verifies that an entity does not violate any validation constraints.
Creates a new FileUpload instance.
Handles JSON:API file upload requests.
Handles JSON:API file upload requests.
Ensures that the given account is allowed to upload a file.
Validates and loads a field definition instance.
Details
static protected
validate(EntityInterface $entity, array $field_names = NULL)
Verifies that an entity does not violate any validation constraints.
__construct(AccountInterface $current_user, EntityFieldManagerInterface $field_manager, TemporaryJsonapiFileFieldUploader $file_uploader, HttpKernelInterface $http_kernel)
Creates a new FileUpload instance.
ResourceResponse
handleFileUploadForExistingResource(Request $request, ResourceType $resource_type, string $file_field_name, FieldableEntityInterface $entity)
Handles JSON:API file upload requests.
ResourceResponse
handleFileUploadForNewResource(Request $request, ResourceType $resource_type, string $file_field_name)
Handles JSON:API file upload requests.
static protected
ensureFileUploadAccess(AccountInterface $account, FieldDefinitionInterface $field_definition, FieldableEntityInterface $entity = NULL)
Ensures that the given account is allowed to upload a file.
protected FieldDefinitionInterface
validateAndLoadFieldDefinition(string $entity_type_id, string $bundle, string $field_name)
Validates and loads a field definition instance.