Mapado pretty-types
Installation
composer require mapado/pretty-types
JSON pretty
Based on Doctrine DBAL types
., (*1)
Will store pretty printed JSON into database., (*2)
Configuration
In your config file, (*3)
# Doctrine Configuration
doctrine:
dbal:
types:
json_pretty: Mapado\PrettyTypes\JsonPrettyType
Usage
In your entities, (*4)
/**
* ...
*
* @ORM\Column(name="column_name", type="json_pretty")
*/
UTCDateTime
If you want to store datetime in UTC in your database., (*5)
Copied version from Working with DateTime Instances., (*6)
All credits goes to the doctrine team !, (*7)
Configuration
In your config file, (*8)
# Doctrine Configuration
doctrine:
dbal:
types:
datetime: Mapado\PrettyTypes\UTCDateTimeType
datetimetz: Mapado\PrettyTypes\UTCDateTimeType
Be aware that this will override all datetimes configured with doctrine., (*9)
If you do not want to override everything and use a custom types instead:, (*10)
# Doctrine Configuration
doctrine:
dbal:
types:
utcdatetime: Mapado\PrettyTypes\UTCDateTimeType
Usage
In your entities, (*11)
/**
* ...
*
* @ORM\Column(name="column_name", type="datetime")
*/
You should store the timezone next to the datetime too. Read the doctrine documentation for more informations., (*12)
If you configured a custom type, use this instead:, (*13)
/**
* @ORM\Column(name="column_name", type="utcdatetime")
*/
License
This project is licensed under the MIT license., (*14)