/** * {@inheritdoc} */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { if (null === $value) { return null; } $encoded = json_encode($value); if (JSON_ERROR_NONE !== json_last_error()) { throw ConversionException::conversionFailedSerialization($value, 'json', $this->getLastErrorMessage()); } return $encoded; }