eZPublishCommunityProject  2013.9
eZ\Publish\Core\IO\IOService Class Reference

Public Member Functions

 __construct (Handler $handler, MimeTypeDetector $mimeTypeDetector, array $settings=array())
 Setups service with reference to repository object that created it & corresponding handler. More...
 
 createBinaryFile (BinaryFileCreateStruct $binaryFileCreateStruct)
 Creates a binary file in the repository. More...
 
 deleteBinaryFile (BinaryFile $binaryFile)
 Deletes the BinaryFile with $path. More...
 
 exists ($binaryFileId)
 
 getExternalPath ($internalId)
 Returns the external path to $internalPath. More...
 
 getFileContents (BinaryFile $binaryFile)
 Returns the content of the binary file. More...
 
 getFileInputStream (BinaryFile $binaryFile)
 Returns a read (mode: rb) file resource to the binary file identified by $path. More...
 
 getInternalPath ($externalId)
 Returns the internal, handler level path to $externalPath. More...
 
 getMetadata (MetadataHandler $metadataHandler, BinaryFile $binaryFile)
 
 getUri ($id)
 Returns the public HTTP uri for $path. More...
 
 loadBinaryFile ($binaryFileId)
 Loads the binary file with $id. More...
 
 newBinaryCreateStructFromLocalFile ($localFile)
 Creates a BinaryFileCreateStruct object from $localFile. More...
 
 newBinaryCreateStructFromUploadedFile (array $uploadedFile)
 Creates a BinaryFileCreateStruct object from the uploaded file $uploadedFile. More...
 

Protected Member Functions

 buildDomainBinaryFileObject (SPIBinaryFile $spiBinaryFile)
 Generates API BinaryFile object from provided SPI BinaryFile object. More...
 
 buildSPIBinaryFileCreateStructObject (BinaryFileCreateStruct $binaryFileCreateStruct)
 Generates SPI BinaryFileCreateStruct object from provided API BinaryFileCreateStruct object. More...
 
 getPrefixedUri ($binaryFileId)
 Returns $uri prefixed with what is configured in the service. More...
 
 removeUriPrefix ($spiBinaryFileId)
 

Protected Attributes

 $ioHandler
 
 $mimeTypeDetector
 
 $settings
 

Constructor & Destructor Documentation

eZ\Publish\Core\IO\IOService::__construct ( Handler  $handler,
MimeTypeDetector  $mimeTypeDetector,
array  $settings = array() 
)

Setups service with reference to repository object that created it & corresponding handler.

Parameters
\eZ\Publish\Core\IO\Handler$handler
array$settings

Member Function Documentation

eZ\Publish\Core\IO\IOService::buildDomainBinaryFileObject ( SPIBinaryFile  $spiBinaryFile)
protected

Generates API BinaryFile object from provided SPI BinaryFile object.

Parameters
\eZ\Publish\SPI\IO\BinaryFile$spiBinaryFile
Returns

Referenced by eZ\Publish\Core\IO\IOService\createBinaryFile(), and eZ\Publish\Core\IO\IOService\loadBinaryFile().

eZ\Publish\Core\IO\IOService::buildSPIBinaryFileCreateStructObject ( BinaryFileCreateStruct  $binaryFileCreateStruct)
protected

Generates SPI BinaryFileCreateStruct object from provided API BinaryFileCreateStruct object.

Parameters
\eZ\Publish\Core\IO\Values\BinaryFileCreateStruct$binaryFileCreateStruct
Returns

Referenced by eZ\Publish\Core\IO\IOService\createBinaryFile().

eZ\Publish\Core\IO\IOService::createBinaryFile ( BinaryFileCreateStruct  $binaryFileCreateStruct)

Creates a binary file in the repository.

Parameters
\eZ\Publish\Core\IO\Values\BinaryFileCreateStruct$binaryFileCreateStruct
Exceptions
\eZ\Publish\Core\Base\Exceptions\InvalidArgumentValue
Returns
The created BinaryFile object

Referenced by eZ\Publish\Core\FieldType\BinaryBase\BinaryBaseStorage\storeFieldData(), and eZ\Publish\Core\FieldType\Image\ImageStorage\storeFieldData().

eZ\Publish\Core\IO\IOService::deleteBinaryFile ( BinaryFile  $binaryFile)

Deletes the BinaryFile with $path.

Parameters
\eZ\Publish\Core\IO\Values\BinaryFile$binaryFile
Exceptions
InvalidArgumentValue

Referenced by eZ\Publish\Core\FieldType\BinaryBase\BinaryBaseStorage\deleteFieldData(), and eZ\Publish\Core\FieldType\BinaryBase\BinaryBaseStorage\removeOldFile().

eZ\Publish\Core\IO\IOService::getExternalPath (   $internalId)

Returns the external path to $internalPath.

Parameters
string$internalId
Returns
string

Referenced by eZ\Publish\Core\FieldType\Image\ImageStorage\getFieldData(), and eZ\Publish\Core\FieldType\Image\ImageStorage\storeFieldData().

eZ\Publish\Core\IO\IOService::getFileContents ( BinaryFile  $binaryFile)

Returns the content of the binary file.

Parameters
\eZ\Publish\Core\IO\Values\BinaryFile$binaryFile
Exceptions
\eZ\Publish\Core\Base\Exceptions\InvalidArgumentValue
Returns
string
eZ\Publish\Core\IO\IOService::getFileInputStream ( BinaryFile  $binaryFile)

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

Parameters
\eZ\Publish\Core\IO\Values\BinaryFile$binaryFile
Exceptions
\eZ\Publish\Core\Base\Exceptions\InvalidArgumentValue
Returns
resource
eZ\Publish\Core\IO\IOService::getMetadata ( MetadataHandler  $metadataHandler,
BinaryFile  $binaryFile 
)
Parameters
MetadataHandler$metadataHandler
BinaryFile$binaryFile
Returns
array

Referenced by eZ\Publish\Core\FieldType\Image\ImageStorage\storeFieldData().

eZ\Publish\Core\IO\IOService::getUri (   $id)

Returns the public HTTP uri for $path.

Parameters
string$path
Returns
string
eZ\Publish\Core\IO\IOService::loadBinaryFile (   $binaryFileId)

Loads the binary file with $id.

Exceptions
\eZ\Publish\Core\Base\Exceptions\InvalidArgumentValueIf the id is invalid
Parameters
string$binaryFileId
Returns
BinaryFile|bool the file, or false if it doesn't exist

Referenced by eZ\Publish\Core\FieldType\BinaryBase\BinaryBaseStorage\deleteFieldData(), eZ\Publish\Core\FieldType\BinaryBase\BinaryBaseStorage\getFieldData(), eZ\Publish\Core\FieldType\Image\ImageStorage\getFieldData(), eZ\Publish\Core\FieldType\BinaryBase\BinaryBaseStorage\removeOldFile(), and eZ\Publish\Core\FieldType\Image\ImageStorage\storeFieldData().

eZ\Publish\Core\IO\IOService::newBinaryCreateStructFromLocalFile (   $localFile)

Creates a BinaryFileCreateStruct object from $localFile.

Exceptions
\eZ\Publish\Core\Base\Exceptions\InvalidArgumentExceptionWhen given a non existing / unreadable file
Parameters
string$localFilePath to local file
Returns

Referenced by eZ\Publish\Core\FieldType\BinaryBase\BinaryBaseStorage\storeFieldData(), and eZ\Publish\Core\FieldType\Image\ImageStorage\storeFieldData().

eZ\Publish\Core\IO\IOService::newBinaryCreateStructFromUploadedFile ( array  $uploadedFile)

Creates a BinaryFileCreateStruct object from the uploaded file $uploadedFile.

Exceptions
\eZ\Publish\Core\Base\Exceptions\InvalidArgumentExceptionWhen given an invalid uploaded file
Parameters
array$uploadedFileThe $_POST hash of an uploaded file
Returns
eZ\Publish\Core\IO\IOService::removeUriPrefix (   $spiBinaryFileId)
protected
Parameters
mixed$spiBinaryFileId
Returns
string
Exceptions
\eZ\Publish\Core\Base\Exceptions\InvalidArgumentException

Referenced by eZ\Publish\Core\IO\IOService\getExternalPath().

Member Data Documentation

eZ\Publish\Core\IO\IOService::$ioHandler
protected
eZ\Publish\Core\IO\IOService::$mimeTypeDetector
protected
eZ\Publish\Core\IO\IOService::$settings
protected

The documentation for this class was generated from the following file: