Skip to content

Commit

Permalink
DDC-3863 - Deprecate old JsonArrayType
Browse files Browse the repository at this point in the history
  • Loading branch information
Taluu committed Aug 4, 2015
1 parent f927d08 commit 0163f63
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 29 deletions.
4 changes: 4 additions & 0 deletions docs/en/reference/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,10 @@ Values retrieved from the database are always converted to PHP's ``array`` or
json_array
^^^^^^^^^^

.. warning::

This type is deprecated since 2.6, you should use ``json`` instead.

Maps and converts array data based on PHP's JSON encoding functions.
If you know that the data to be stored always is in a valid UTF-8
encoded JSON format string, you should consider using this type.
Expand Down
32 changes: 3 additions & 29 deletions lib/Doctrine/DBAL/Types/JsonArrayType.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,11 @@
* Array Type which can be used to generate json arrays.
*
* @since 2.3
* @deprecated Use JsonType instead
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class JsonArrayType extends Type
class JsonArrayType extends JsonType
{
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
return $platform->getJsonTypeDeclarationSQL($fieldDeclaration);
}

/**
* {@inheritdoc}
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if (null === $value) {
return null;
}

return json_encode($value);
}

/**
* {@inheritdoc}
*/
Expand All @@ -70,12 +51,5 @@ public function getName()
{
return Type::JSON_ARRAY;
}

/**
* {@inheritdoc}
*/
public function requiresSQLCommentHint(AbstractPlatform $platform)
{
return ! $platform->hasNativeJsonType();
}
}

0 comments on commit 0163f63

Please sign in to comment.