Вход Регистрация
Файл: vendor/doctrine/dbal/src/Types/BooleanType.php
Строк: 70
<?php

namespace DoctrineDBALTypes;

use 
DoctrineDBALParameterType;
use 
DoctrineDBALPlatformsAbstractPlatform;
use 
DoctrineDBALPlatformsDB2Platform;
use 
DoctrineDeprecationsDeprecation;

/**
 * Type that maps an SQL boolean to a PHP boolean.
 */
class BooleanType extends Type
{
    
/**
     * {@inheritDoc}
     */
    
public function getSQLDeclaration(array $columnAbstractPlatform $platform)
    {
        return 
$platform->getBooleanTypeDeclarationSQL($column);
    }

    
/**
     * {@inheritDoc}
     */
    
public function convertToDatabaseValue($valueAbstractPlatform $platform)
    {
        return 
$platform->convertBooleansToDatabaseValue($value);
    }

    
/**
     * {@inheritDoc}
     *
     * @param T $value
     *
     * @return (T is null ? null : bool)
     *
     * @template T
     */
    
public function convertToPHPValue($valueAbstractPlatform $platform)
    {
        return 
$platform->convertFromBoolean($value);
    }

    
/**
     * {@inheritDoc}
     */
    
public function getName()
    {
        return 
Types::BOOLEAN;
    }

    
/**
     * {@inheritDoc}
     */
    
public function getBindingType()
    {
        return 
ParameterType::BOOLEAN;
    }

    
/**
     * @deprecated
     *
     * @return bool
     */
    
public function requiresSQLCommentHint(AbstractPlatform $platform)
    {
        
Deprecation::triggerIfCalledFromOutside(
            
'doctrine/dbal',
            
'https://github.com/doctrine/dbal/pull/5509',
            
'%s is deprecated.',
            
__METHOD__,
        );

        
// We require a commented boolean type in order to distinguish between
        // boolean and smallint as both (have to) map to the same native type.
        
return $platform instanceof DB2Platform;
    }
}
Онлайн: 0
Реклама