. */ namespace Doctrine\DBAL\Types; use Doctrine\DBAL\Platforms\AbstractPlatform; /** * Array Type which can be used for simple values. * * Only use this type if you are sure that your values cannot contain a ",". * * @since 2.3 * @author Johannes M. Schmitt */ class SimpleArrayType extends Type { public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) { return $platform->getClobTypeDeclarationSQL($fieldDeclaration); } public function convertToDatabaseValue($value, AbstractPlatform $platform) { if (!$value) { return null; } return implode(',', $value); } public function convertToPHPValue($value, AbstractPlatform $platform) { if ($value === null) { return array(); } $value = (is_resource($value)) ? stream_get_contents($value) : $value; return explode(',', $value); } public function getName() { return Type::SIMPLE_ARRAY; } public function requiresSQLCommentHint(AbstractPlatform $platform) { return true; } }