Вход Регистрация
Файл: vendor/doctrine/dbal/lib/Doctrine/DBAL/Types/JsonArrayType.php
Строк: 41
<?php

namespace DoctrineDBALTypes;

use 
DoctrineDBALPlatformsAbstractPlatform;

use function 
is_resource;
use function 
json_decode;
use function 
stream_get_contents;

/**
 * Array Type which can be used to generate json arrays.
 *
 * @deprecated Use JsonType instead
 */
class JsonArrayType extends JsonType
{
    
/**
     * {@inheritdoc}
     */
    
public function convertToPHPValue($valueAbstractPlatform $platform)
    {
        if (
$value === null || $value === '') {
            return [];
        }

        
$value is_resource($value) ? stream_get_contents($value) : $value;

        return 
json_decode($valuetrue);
    }

    
/**
     * {@inheritdoc}
     */
    
public function getName()
    {
        return 
Types::JSON_ARRAY;
    }

    
/**
     * {@inheritdoc}
     */
    
public function requiresSQLCommentHint(AbstractPlatform $platform)
    {
        return 
true;
    }
}
Онлайн: 0
Реклама