PHP Class Atrauzzi\LaravelDoctrine\Type\Json
Doctrine has a json_array type but, as its name suggests, it was designed with
only arrays in mind. This extending type fixes a bug with the json_array type
wherein a null value in database gets converted to an empty array.
IMPORTANT NOTE: you must register custom types with Doctrine:
\Doctrine\DBAL\Types\Type::addType('json', '\Path\To\Custom\Type\Json');
Note from atrauzzi: I'm including this as a convenience for anyone using my package.
Show file
Open project: atrauzzi/laravel-doctrine
Public Methods
Method |
Description |
|
convertToPHPValue ( $value, Doctrine\DBAL\Platforms\AbstractPlatform $platform ) |
When database value is null, we return null instead of empty array like our parent does. |
|
getName ( ) |
|
|
getSQLDeclaration ( array $fieldDeclaration, Doctrine\DBAL\Platforms\AbstractPlatform $platform ) |
Made to be compatible with Doctrine 2.4 and 2.5; 2.5 added getJsonTypeDeclarationSQL(). |
|
Method Details
convertToPHPValue()
public method
public convertToPHPValue ( $value, Doctrine\DBAL\Platforms\AbstractPlatform $platform ) |
$platform |
Doctrine\DBAL\Platforms\AbstractPlatform |
|
getSQLDeclaration()
public method
public getSQLDeclaration ( array $fieldDeclaration, Doctrine\DBAL\Platforms\AbstractPlatform $platform ) |
$fieldDeclaration |
array |
|
$platform |
Doctrine\DBAL\Platforms\AbstractPlatform |
|