Class

eZ\Publish\Core\FieldType\Media\MediaStorage

class MediaStorage extends BinaryBaseStorage

Description of MediaStorage.

Methods

__construct(StorageGateway $gateway, IOServiceInterface $IOService, PathGenerator $pathGenerator, MimeTypeDetector $mimeTypeDetector)

Construct from gateways.

from BinaryBaseStorage
setDownloadUrlGenerator(PathGenerator $downloadUrlGenerator)

from BinaryBaseStorage
mixed storeFieldData(VersionInfo $versionInfo, Field $field, array $context)

Allows custom field types to store data in an external source (e.g.

from BinaryBaseStorage
null|bool copyLegacyField(VersionInfo $versionInfo, Field $field, Field $originalField, array $context)

This method is used exclusively by Legacy Storage to copy external data of existing field in main language to the untranslatable field not passed in create or update struct, but created implicitly in storage layer.

from BinaryBaseStorage
getFieldData(VersionInfo $versionInfo, Field $field, array $context)

Populates $field value property based on the external data.

from BinaryBaseStorage
bool deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array $context)

Deletes field data for all $fieldIds in the version identified by $versionInfo.

from BinaryBaseStorage
bool hasFieldData()

Checks if field type has external data to deal with.

from BinaryBaseStorage
Field[] getIndexData(VersionInfo $versionInfo, Field $field, array $context)

Get index data for external data for search backend.

from BinaryBaseStorage

Details

in BinaryBaseStorage at line 51
public __construct(StorageGateway $gateway, IOServiceInterface $IOService, PathGenerator $pathGenerator, MimeTypeDetector $mimeTypeDetector)

Construct from gateways.

Parameters

StorageGateway $gateway
IOServiceInterface $IOService
PathGenerator $pathGenerator
MimeTypeDetector $mimeTypeDetector

in BinaryBaseStorage at line 66
public setDownloadUrlGenerator(PathGenerator $downloadUrlGenerator)

Parameters

PathGenerator $downloadUrlGenerator

in BinaryBaseStorage at line 71
public mixed storeFieldData(VersionInfo $versionInfo, Field $field, array $context)

Allows custom field types to store data in an external source (e.g.

another DB table).

Stores value for $field in an external data source. The whole {@link eZ\Publish\SPI\Persistence\Content\Field} object is passed and its value is accessible through the {@link eZ\Publish\SPI\Persistence\Content\FieldValue} 'value' property. This value holds the data filled by the user as a {@link eZ\Publish\Core\FieldType\Value} based object, according to the field type (e.g. for TextLine, it will be a {@link eZ\Publish\Core\FieldType\TextLine\Value} object).

$field->id = unique ID from the attribute tables (needs to be generated by database back end on create, before the external data source may be called from storing).

The context array provides some context for the field handler about the currently used storage engine. The array should at least define 2 keys : - identifier (connection identifier) - connection (the connection handler) For example, using Legacy storage engine, $context will be: - identifier = 'LegacyStorage' - connection = {@link \eZ\Publish\Core\Persistence\Doctrine\ConnectionHandler} object handler (for DB connection), to be used accordingly to {@link http://incubator.apache.org/zetacomponents/documentation/trunk/Database/tutorial.html ezcDatabase} usage

This method might return true if $field needs to be updated after storage done here (to store a PK for instance). In any other case, this method must not return anything (null).

Parameters

VersionInfo $versionInfo
Field $field
array $context

Return Value

mixed null|true

in BinaryBaseStorage at line 102
public null|bool copyLegacyField(VersionInfo $versionInfo, Field $field, Field $originalField, array $context)

This method is used exclusively by Legacy Storage to copy external data of existing field in main language to the untranslatable field not passed in create or update struct, but created implicitly in storage layer.

By default the method falls back to the {@link \eZ\Publish\SPI\FieldType\FieldStorage::storeFieldData()}. External storages implement this method as needed.

Parameters

VersionInfo $versionInfo
Field $field
Field $originalField
array $context

Return Value

null|bool Same as {@link \eZ\Publish\SPI\FieldType\FieldStorage::storeFieldData()}.

in BinaryBaseStorage at line 140
public getFieldData(VersionInfo $versionInfo, Field $field, array $context)

Populates $field value property based on the external data.

$field->value is a {@link eZ\Publish\SPI\Persistence\Content\FieldValue} object. This value holds the data as a {@link eZ\Publish\Core\FieldType\Value} based object, according to the field type (e.g. for TextLine, it will be a {@link eZ\Publish\Core\FieldType\TextLine\Value} object).

Parameters

VersionInfo $versionInfo
Field $field
array $context

in BinaryBaseStorage at line 152
public bool deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array $context)

Deletes field data for all $fieldIds in the version identified by $versionInfo.

Parameters

VersionInfo $versionInfo
array $fieldIds Array of field IDs
array $context

Return Value

bool

in BinaryBaseStorage at line 172
public bool hasFieldData()

Checks if field type has external data to deal with.

Return Value

bool

in BinaryBaseStorage at line 177
public Field[] getIndexData(VersionInfo $versionInfo, Field $field, array $context)

Get index data for external data for search backend.

Parameters

VersionInfo $versionInfo
Field $field
array $context

Return Value

Field[]