for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace DoS\ResourceBundle\Doctrine\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
/**
* convert a value into a json string to be stored into the persistency layer.
*/
class JsonType extends Type
{
const JSON = 'json'; // modify to match your type name
* {@inheritdoc}
public function convertToPHPValue($value, AbstractPlatform $platform)
return json_decode($value, true);
}
public function convertToDatabaseValue($value, AbstractPlatform $platform)
return json_encode($value);
public function getName()
return self::JSON;
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
return $platform->getClobTypeDeclarationSQL($fieldDeclaration);
public function requiresSQLCommentHint(AbstractPlatform $platform)
return true;