Interface

eZ\Publish\Core\IO\IOServiceInterface

interface IOServiceInterface

Interface for Input/Output handling of binary files.

Methods

setPrefix(string $prefix)

The the internal prefix added by the IO Service.

string getExternalPath(string $internalId)

Returns the external path to $internalPath.

BinaryFileCreateStruct newBinaryCreateStructFromLocalFile(string $localFile)

Creates a BinaryFileCreateStruct object from $localFile.

bool exists(string $binaryFileId)

Checks if a Binary File with $binaryFileId exists.

string getInternalPath(string $externalId)

Returns the internal, handler level path to $externalPath.

BinaryFile loadBinaryFile(string $binaryFileId)

Loads the binary file with $id.

BinaryFile loadBinaryFileByUri(string $binaryFileUri)

Loads the binary file with uri $uri.

string getFileContents(BinaryFile $binaryFile)

Returns the content of the binary file.

BinaryFile createBinaryFile(BinaryFileCreateStruct $binaryFileCreateStruct)

Creates a binary file in the repository.

string getUri(string $binaryFileId)

Returns the public HTTP uri for $binaryFileId.

string|null getMimeType(string $binaryFileId)

Gets the mime-type of the BinaryFile.

resource getFileInputStream(BinaryFile $binaryFile)

Returns a read (mode: rb) file resource to the binary file identified by $path.

deleteBinaryFile(BinaryFile $binaryFile)

Deletes the BinaryFile with $id.

BinaryFileCreateStruct newBinaryCreateStructFromUploadedFile(array $uploadedFile)

Creates a BinaryFileCreateStruct object from the uploaded file $uploadedFile.

deleteDirectory(string $path)

Deletes a directory.

Details

at line 24
public setPrefix(string $prefix)

The the internal prefix added by the IO Service.

Parameters

string $prefix

at line 35
public string getExternalPath(string $internalId)

Returns the external path to $internalPath.

Parameters

string $internalId

Return Value

string

at line 46
public BinaryFileCreateStruct newBinaryCreateStructFromLocalFile(string $localFile)

Creates a BinaryFileCreateStruct object from $localFile.

Parameters

string $localFile Path to local file

Return Value

BinaryFileCreateStruct

Exceptions

InvalidArgumentException When given a non existing / unreadable file

at line 55
public bool exists(string $binaryFileId)

Checks if a Binary File with $binaryFileId exists.

Parameters

string $binaryFileId

Return Value

bool

at line 66
public string getInternalPath(string $externalId)

Returns the internal, handler level path to $externalPath.

Parameters

string $externalId

Return Value

string

at line 80
public BinaryFile loadBinaryFile(string $binaryFileId)

Loads the binary file with $id.

Parameters

string $binaryFileId

Return Value

BinaryFile the file, or false if it doesn't exist

Exceptions

InvalidArgumentValue If the id is invalid
NotFoundException If no file identified by $binaryFileId exists
InvalidArgumentValue If $binaryFileId is invalid

at line 93
public BinaryFile loadBinaryFileByUri(string $binaryFileUri)

Loads the binary file with uri $uri.

Parameters

string $binaryFileUri

Return Value

BinaryFile the file, or false if it doesn't exist

Exceptions

InvalidArgumentValue If the id is invalid
NotFoundException If no file identified by $binaryFileId exists

at line 105
public string getFileContents(BinaryFile $binaryFile)

Returns the content of the binary file.

Parameters

BinaryFile $binaryFile

Return Value

string

Exceptions

NotFoundException If $binaryFile isn't found
InvalidArgumentValue

at line 116
public BinaryFile createBinaryFile(BinaryFileCreateStruct $binaryFileCreateStruct)

Creates a binary file in the repository.

Parameters

BinaryFileCreateStruct $binaryFileCreateStruct

Return Value

BinaryFile The created BinaryFile object

Exceptions

InvalidArgumentValue

at line 125
public string getUri(string $binaryFileId)

Returns the public HTTP uri for $binaryFileId.

Parameters

string $binaryFileId

Return Value

string

at line 136
public string|null getMimeType(string $binaryFileId)

Gets the mime-type of the BinaryFile.

Example: text/xml

Parameters

string $binaryFileId

Return Value

string|null

at line 147
public resource getFileInputStream(BinaryFile $binaryFile)

Returns a read (mode: rb) file resource to the binary file identified by $path.

Parameters

BinaryFile $binaryFile

Return Value

resource

Exceptions

InvalidArgumentValue

at line 156
public deleteBinaryFile(BinaryFile $binaryFile)

Deletes the BinaryFile with $id.

Parameters

BinaryFile $binaryFile

Exceptions

InvalidArgumentValue

at line 167
public BinaryFileCreateStruct newBinaryCreateStructFromUploadedFile(array $uploadedFile)

Creates a BinaryFileCreateStruct object from the uploaded file $uploadedFile.

Parameters

array $uploadedFile The $_POST hash of an uploaded file

Return Value

BinaryFileCreateStruct

Exceptions

InvalidArgumentException When given an invalid uploaded file

at line 174
public deleteDirectory(string $path)

Deletes a directory.

Parameters

string $path