{@inheritdoc}
@param array $fieldDeclaration
@param AbstractPlatform $platform
@return string
550624
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
	{
		$fieldDeclaration['length'] = 20;
		$fieldDeclaration['fixed'] = true;

		$sql = $platform->getVarcharTypeDeclarationSQL($fieldDeclaration);

		//todo: check if this is sane, at least
		$sql .= ' COLLATE ascii_general_ci';

		return $sql;
	}
97875
public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
    {
        if ($platform instanceof MySqlPlatform) {
            return sprintf('PointFromText(%s)', $sqlExpr);
        } else {
            return parent::convertToDatabaseValueSQL($sqlExpr, $platform);
        }
    }
581710
public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
    {
        return $this->getSpatialPlatform($platform)->convertToDatabaseValueSQL($this, $sqlExpr);
    }
1168496
public function getQuotedName(AbstractPlatform $platform)
    {
        $keywords = $platform->getReservedKeywordsList();
        $parts    = explode('.', $this->getName());
        foreach ($parts as $k => $v) {
            $parts[$k] = $this->_quoted || $keywords->isKeyword($v) ? $platform->quoteIdentifier($v) : $v;
        }

        return implode('.', $parts);
    }
421504
public function prepareGeneratedFieldStatement(FieldInterface $source_field, ValueExtractorInterface $extractor)
    {
        $generated_field_name = $this->getConnection()->escapeFieldName($extractor->getFieldName());

        switch ($extractor->getValueCaster()) {
            case ValueCasterInterface::CAST_INT:
                $field_type = 'INT';
                break;
            case ValueCasterInterface::CAST_FLOAT:
                $field_type = 'DECIMAL(12, 2)';
                break;
            case ValueCasterInterface::CAST_BOOL:
                $field_type = 'TINYINT(1) UNSIGNED';
                break;
            case ValueCasterInterface::CAST_DATE:
                $field_type = 'DATE';
                break;
            case ValueCasterInterface::CAST_DATETIME:
                $field_type = 'DATETIME';
                break;
            case ValueCasterInterface::CAST_JSON:
                $field_type = 'JSON';
                break;
            default:
                $field_type = 'VARCHAR(191)';
        }

        $expression = $this->prepareGeneratedFieldExpression(
            $this->getConnection()->escapeFieldName($source_field->getName()),
            var_export($extractor->getExpression(), true),
            $extractor->getValueCaster(),
            $this->getConnection()->escapeValue($extractor->getDefaultValue())
        );
        $storage = $extractor->getStoreValue() ? 'STORED' : 'VIRTUAL';

        return trim("$generated_field_name $field_type AS ($expression) $storage");
    }
475872
public function getFieldName(SPIValue $value, FieldDefinition $fieldDefinition, $languageCode)
    {
        return $this->fieldType->getName($value);
    }
940391
public function convertToPHPValue($value, AbstractPlatform $platform)
    {
        if (is_string($value)) {
            return parent::convertToPHPValue($value, $platform);
        }

        return $value;
    }
106119
public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        if ($value instanceof DateTimeOfDay) {
            return $value->toDateTime()->format($platform->getDateTimeFormatString());
        }
        return parent::convertToDatabaseValue($value, $platform);
    }
422668
public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        return parent::convertToDatabaseValue(
            $this->convertToDateTimeFromString($value, $platform->getDateTimeFormatString(), static::NAME),
            $platform
        );
    }
298536
private function convertTypeDeclarationsToInstances(ReflectionMethod $method, Field $field): void
    {
        $field->type = $this->getTypeFromPhpDeclaration($method, $field->type);
        $args = [];

        /** @var Argument $arg */
        foreach ($field->args as $arg) {
            $arg->setTypeInstance($this->getTypeFromPhpDeclaration($method, $arg->getType()));
            $args[$arg->getName()] = $arg;
        }
        $field->args = $args;
    }
1296623
public function convertToPHPValueSql($value, AbstractPlatform $platform)
    {
        $opts = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;

        if (is_object($value)) {
            if (method_exists($value, 'toJson')) {
                $value = $value->toJson();
            } elseif (method_exists($value, 'toArray')) {
                $value = json_encode($value->toArray(), $opts);
            } else {
                $value = json_encode($value, $opts);
            }
        }

        return parent::convertToPHPValueSql($value, $platform);
    }
625097
public function getRouteListByPlatform($platformId, $fields = null)
    {
        $params = array(
            'platform_id' => (int)$platformId,
        );
        if ($fields) {
            $params['fields'] = (string)$fields;
        }
        return $this->getInternalList(
            'transport/route/list',
            'Route',
            $params
        );
    }
1117888
private function resolvePhpDocParamTypes($tokens, $useDeclarations, $namespaceDeclarations)
    {
        foreach ($tokens->findGivenKind(T_DOC_COMMENT) as $token) {
            $doc = new DocBlock($token->getContent());
            $annotations = $doc->getAnnotationsOfType('param');
            if (empty($annotations)) {
                continue;
            }
            foreach ($annotations as $annotation) {
                $line = $doc->getLine($annotation->getStart());

                $matches = $this->getMatches($line->getContent());
                if (null === $matches) {
                    continue;
                }

                if (!isset($matches['hint'])) {
                    continue;
                }

                if (substr($matches['hint'], 0, 1) === '\\') {
                    continue;
                }

                if (false !== strpos($matches['hint'], '\\')) {
                    continue;
                }

                $resolved = false;

                // resolve hint
                foreach ($useDeclarations as $useDeclaration) {
                    // replace hint by useDeclaration fullname if it match
                    if (in_array($matches['hint'], array($useDeclaration['shortName'], $useDeclaration['aliased']), true)) {
                        $line->setContent(str_replace($matches['hint'], $useDeclaration['fullName'], $line->getContent()));
                        $resolved = true;
                        break;
                    }
                }

                if ($resolved) {
                    continue;
                }

                // add namespace if needed
                $namespace = $namespaceDeclarations[0]['name'];

                if (false === strpos($matches['hint'], '\\')) {
                    $line->setContent(str_replace($matches['hint'], $namespace.'\\'.$matches['hint'], $line->getContent()));
                }
            }

            $token->setContent($doc->getContent());
        }
    }
1298191
public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        if (null === $value || '' === $value) {
            return $value;
        }

        if ( ! $value instanceof Email) {
            $type = is_object($value) ? get_class($value) : gettype($value);
            throw new \InvalidArgumentException(sprintf('You have to pass an object of kind \SerendipityHQ\Component\ValueObjects\Email\Email to use the Doctrine type EmailType. "%s" passed instead.', $type));
        }

        // Validate the $value as a valid email
        $validator = new EmailValidator();

        if ( ! $validator->isValid($value, new RFCValidation())) {
            throw new \InvalidArgumentException(sprintf('An email field accepts only valid email addresses. The value "%s" is not a valid email.', $value));
        }

        // The value is automatically transformed into a string thans to the __toString() method
        return $value;
    }
295480
public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        if ($value instanceof Date) {
            return $value->toDateTime()->format($platform->getDateFormatString());
        }
        return parent::convertToDatabaseValue($value, $platform);
    }
427155
public static function createFromDataModel(VariableDeclaration $variableDeclaration)
    {
        $variable = parent::createFromDataModel($variableDeclaration);

        if ($variableDeclaration instanceof ResponseDeclaration) {

            $variable->setMapping($variableDeclaration->getMapping());
            $variable->setAreaMapping($variableDeclaration->getAreaMapping());

            $dataModelCorrectResponse = $variableDeclaration->getCorrectResponse();
            if (!empty($dataModelCorrectResponse)) {
                $baseType = $variable->getBaseType();
                $cardinality = $variable->getCardinality();
                $dataModelValues = $dataModelCorrectResponse->getValues();
                $correctResponse = static::dataModelValuesToRuntime($dataModelValues, $baseType, $cardinality);

                $variable->setCorrectResponse($correctResponse);
            }

            return $variable;
        } else {
            $msg = "ResponseVariable::createFromDataModel only accept 'qtism\\data\\state\\ResponseDeclaration' objects, '" . get_class($variableDeclaration) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
219881
final public static function resolveValue($value, AbstractPlatform $platform)
    {
        if ($value instanceof DomainId) {
            $class = \get_class($value);
            $type = Type::INTEGER;

            foreach (self::$mapping as $mapping) {
                if ($class === $mapping['class']) {
                    $type = $mapping['data_type'] ?? $type;
                    break;
                }
            }

            return self::getType($type)->convertToPHPValue($value->isEmpty() ? null : $value->toString(), $platform);
        }

        return $value;
    }