PHP Class eZ\Publish\Core\FieldType\Image\IO\Legacy

Acts as a dispatcher between the two IOService instances required by FieldType\Image in Legacy. - One is the usual one, as used in ImageStorage, that uses 'images' as the prefix - The other is a special one, that uses 'images-versioned' as the prefix, in order to cope with content created from the backoffice To load a binary file, this service will first try with the normal IOService, and on exception, will fall back to the draft IOService. In addition, loadBinaryFile() will also hide the need to explicitly call getExternalPath() on the internal path stored in legacy.
Inheritance: implements eZ\Publish\Core\IO\IOServiceInterface
Datei anzeigen Open project: ezsystems/ezpublish-kernel Class Usage Examples

Public Methods

Method Description
__construct ( eZ\Publish\Core\IO\IOServiceInterface $publishedIOService, eZ\Publish\Core\IO\IOServiceInterface $draftIOService, eZ\Publish\Core\FieldType\Image\IO\OptionsProvider $optionsProvider )
createBinaryFile ( BinaryFileCreateStruct $binaryFileCreateStruct )
deleteBinaryFile ( BinaryFile $binaryFile )
deleteDirectory ( string $path ) Deletes a directory.
exists ( $binaryFileId )
getExternalPath ( $internalId )
getFileContents ( BinaryFile $binaryFile )
getFileInputStream ( BinaryFile $binaryFile )
getInternalPath ( $externalId )
getMimeType ( $binaryFileId )
getUri ( $binaryFileId )
loadBinaryFile ( $binaryFileId )
loadBinaryFileByUri ( $binaryFileUri ) Since both services should use the same uri, we can use any of them to *GET* the URI.
newBinaryCreateStructFromLocalFile ( $localFile )
newBinaryCreateStructFromUploadedFile ( array $uploadedFile )
setPrefix ( $prefix ) Sets the IOService prefix.

Protected Methods

Method Description
isDraftImagePath ( string $internalPath ) : boolean Checks if $internalPath is a published image path.
isPublishedImagePath ( string $internalPath ) : boolean Checks if $internalPath is a published image path.

Private Methods

Method Description
setPrefixes ( ) Computes the paths to published & draft images path using the options from the provider.

Method Details

__construct() public method

public __construct ( eZ\Publish\Core\IO\IOServiceInterface $publishedIOService, eZ\Publish\Core\IO\IOServiceInterface $draftIOService, eZ\Publish\Core\FieldType\Image\IO\OptionsProvider $optionsProvider )
$publishedIOService eZ\Publish\Core\IO\IOServiceInterface
$draftIOService eZ\Publish\Core\IO\IOServiceInterface
$optionsProvider eZ\Publish\Core\FieldType\Image\IO\OptionsProvider

createBinaryFile() public method

public createBinaryFile ( BinaryFileCreateStruct $binaryFileCreateStruct )
$binaryFileCreateStruct eZ\Publish\Core\IO\Values\BinaryFileCreateStruct

deleteBinaryFile() public method

public deleteBinaryFile ( BinaryFile $binaryFile )
$binaryFile eZ\Publish\Core\IO\Values\BinaryFile

deleteDirectory() public method

Deletes a directory.
public deleteDirectory ( string $path )
$path string

exists() public method

public exists ( $binaryFileId )

getExternalPath() public method

public getExternalPath ( $internalId )

getFileContents() public method

public getFileContents ( BinaryFile $binaryFile )
$binaryFile eZ\Publish\Core\IO\Values\BinaryFile

getFileInputStream() public method

public getFileInputStream ( BinaryFile $binaryFile )
$binaryFile eZ\Publish\Core\IO\Values\BinaryFile

getInternalPath() public method

public getInternalPath ( $externalId )

getMimeType() public method

public getMimeType ( $binaryFileId )

getUri() public method

public getUri ( $binaryFileId )

isDraftImagePath() protected method

Checks if $internalPath is a published image path.
protected isDraftImagePath ( string $internalPath ) : boolean
$internalPath string
return boolean true if $internalPath is the path to a published image

isPublishedImagePath() protected method

Checks if $internalPath is a published image path.
protected isPublishedImagePath ( string $internalPath ) : boolean
$internalPath string
return boolean true if $internalPath is the path to a published image

loadBinaryFile() public method

public loadBinaryFile ( $binaryFileId )

loadBinaryFileByUri() public method

Since both services should use the same uri, we can use any of them to *GET* the URI.
public loadBinaryFileByUri ( $binaryFileUri )

newBinaryCreateStructFromLocalFile() public method

public newBinaryCreateStructFromLocalFile ( $localFile )

newBinaryCreateStructFromUploadedFile() public method

public newBinaryCreateStructFromUploadedFile ( array $uploadedFile )
$uploadedFile array

setPrefix() public method

Sets the IOService prefix.
public setPrefix ( $prefix )