class FileUploadResponse in GraphQL 8.4
A response that either has a file entity or some violations.
Hierarchy
- class \Drupal\graphql\GraphQL\Response\Response implements ResponseInterface
- class \Drupal\graphql\GraphQL\Response\FileUploadResponse
Expanded class hierarchy of FileUploadResponse
1 file declares its use of FileUploadResponse
- FileUpload.php in src/
GraphQL/ Utility/ FileUpload.php
File
- src/
GraphQL/ Response/ FileUploadResponse.php, line 12
Namespace
Drupal\graphql\GraphQL\ResponseView source
class FileUploadResponse extends Response {
/**
* The file entities in case of successful file upload.
*
* @var \Drupal\file\FileInterface[]
*/
protected $fileEntities = [];
/**
* Sets file entity.
*
* @param \Drupal\file\FileInterface $fileEntity
* File entity.
*/
public function setFileEntity(FileInterface $fileEntity) : void {
$this->fileEntities[] = $fileEntity;
}
/**
* Sets file entities.
*
* @param \Drupal\file\FileInterface[] $fileEntities
* File entities.
*/
public function setFileEntities(array $fileEntities) : void {
$this->fileEntities = $fileEntities;
}
/**
* Get the first file entity if there is one.
*
* @return \Drupal\file\FileInterface|null
* First file entity or NULL.
*/
public function getFileEntity() : ?FileInterface {
return $this->fileEntities[0] ?? NULL;
}
/**
* Get the file entities.
*
* @return \Drupal\file\FileInterface[]
* File entities.
*/
public function getFileEntities() : array {
return $this->fileEntities;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FileUploadResponse:: |
protected | property | The file entities in case of successful file upload. | |
FileUploadResponse:: |
public | function | Get the file entities. | |
FileUploadResponse:: |
public | function | Get the first file entity if there is one. | |
FileUploadResponse:: |
public | function | Sets file entities. | |
FileUploadResponse:: |
public | function | Sets file entity. | |
Response:: |
protected | property | List of violations. | |
Response:: |
public | function |
Adds the violation. Overrides ResponseInterface:: |
|
Response:: |
public | function |
Adds multiple violations. Overrides ResponseInterface:: |
|
Response:: |
public | function |
Gets the violations. Overrides ResponseInterface:: |
|
Response:: |
public | function |
Adds the violations from another response to this response. Overrides ResponseInterface:: |