PHP Class Neos\Flow\Persistence\Doctrine\DataTypes\JsonArrayType

TODO: If doctrine supports a Postgres 9.4 platform we could default to jsonb.
Inheritance: extends Doctrine\DBAL\Types\JsonArrayType
Show file Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$persistenceManager Neos\Flow\Persistence\PersistenceManagerInterface
$reflectionService Neos\Flow\Reflection\ReflectionService

Public Methods

Method Description
convertToDatabaseValue ( array $array, Doctrine\DBAL\Platforms\AbstractPlatform $platform ) : mixed Converts a value from its PHP representation to its database representation of this type.
convertToPHPValue ( mixed $value, Doctrine\DBAL\Platforms\AbstractPlatform $platform ) : array Converts a value from its database representation to its PHP representation of this type.
getBindingType ( ) : integer Gets the (preferred) binding type for values of this type that can be used when binding parameters to prepared statements.
getMappedDatabaseTypes ( Doctrine\DBAL\Platforms\AbstractPlatform $platform ) : array We map jsonb fields to our datatype by default. Doctrine doesn't use jsonb at all.
getName ( ) : string Gets the name of this type.
getSQLDeclaration ( array $fieldDeclaration, Doctrine\DBAL\Platforms\AbstractPlatform $platform ) : string Use jsonb for PostgreSQL, this means we require PostgreSQL 9.4
requiresSQLCommentHint ( Doctrine\DBAL\Platforms\AbstractPlatform $platform ) : boolean We require a comment on the column to make doctrine recognize the type on already existing columns

Protected Methods

Method Description
decodeObjectReferences ( array &$array ) : void Traverses the $array and replaces known persisted objects (tuples of type and identifier) with actual instances.
encodeObjectReferences ( array &$array ) : void Traverses the $array and replaces known persisted objects with a tuple of type and identifier.
initializeDependencies ( ) : void Fetches dependencies from the static object manager.

Method Details

convertToDatabaseValue() public method

Converts a value from its PHP representation to its database representation of this type.
public convertToDatabaseValue ( array $array, Doctrine\DBAL\Platforms\AbstractPlatform $platform ) : mixed
$array array The value to convert.
$platform Doctrine\DBAL\Platforms\AbstractPlatform The currently used database platform.
return mixed The database representation of the value.

convertToPHPValue() public method

Converts a value from its database representation to its PHP representation of this type.
public convertToPHPValue ( mixed $value, Doctrine\DBAL\Platforms\AbstractPlatform $platform ) : array
$value mixed The value to convert.
$platform Doctrine\DBAL\Platforms\AbstractPlatform The currently used database platform.
return array The PHP representation of the value.

decodeObjectReferences() protected method

Traverses the $array and replaces known persisted objects (tuples of type and identifier) with actual instances.
protected decodeObjectReferences ( array &$array ) : void
$array array
return void

encodeObjectReferences() protected method

Traverses the $array and replaces known persisted objects with a tuple of type and identifier.
protected encodeObjectReferences ( array &$array ) : void
$array array
return void

getBindingType() public method

Gets the (preferred) binding type for values of this type that can be used when binding parameters to prepared statements.
public getBindingType ( ) : integer
return integer

getMappedDatabaseTypes() public method

We map jsonb fields to our datatype by default. Doctrine doesn't use jsonb at all.
public getMappedDatabaseTypes ( Doctrine\DBAL\Platforms\AbstractPlatform $platform ) : array
$platform Doctrine\DBAL\Platforms\AbstractPlatform
return array

getName() public method

Gets the name of this type.
public getName ( ) : string
return string

getSQLDeclaration() public method

Use jsonb for PostgreSQL, this means we require PostgreSQL 9.4
public getSQLDeclaration ( array $fieldDeclaration, Doctrine\DBAL\Platforms\AbstractPlatform $platform ) : string
$fieldDeclaration array The field declaration
$platform Doctrine\DBAL\Platforms\AbstractPlatform The currently used database platform
return string

initializeDependencies() protected method

Injection cannot be used, since __construct on Types\Type is final.
protected initializeDependencies ( ) : void
return void

requiresSQLCommentHint() public method

We require a comment on the column to make doctrine recognize the type on already existing columns
public requiresSQLCommentHint ( Doctrine\DBAL\Platforms\AbstractPlatform $platform ) : boolean
$platform Doctrine\DBAL\Platforms\AbstractPlatform
return boolean

Property Details

$persistenceManager protected property

protected PersistenceManagerInterface,Neos\Flow\Persistence $persistenceManager
return Neos\Flow\Persistence\PersistenceManagerInterface

$reflectionService protected property

protected ReflectionService,Neos\Flow\Reflection $reflectionService
return Neos\Flow\Reflection\ReflectionService