name ?: 'enum'; } /** * @param mixed[] $fieldDeclaration */ public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string { return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration); } /** * @param mixed $value * @return mixed * @throws InvalidArgumentException */ public function convertToPHPValue($value, AbstractPlatform $platform) { if ($value === null) { return null; } // If the enumeration provides a casting method, apply it if (method_exists($this->enumClass, 'castValueIn')) { /** @var callable $castValueIn */ $castValueIn = [$this->enumClass, 'castValueIn']; $value = $castValueIn($value); } // Check if the value is valid for this enumeration /** @var callable $isValidCallable */ $isValidCallable = [$this->enumClass, 'isValid']; $isValid = $isValidCallable($value); if (! $isValid) { /** @var callable $toArray */ $toArray = [$this->enumClass, 'toArray']; throw new InvalidArgumentException(sprintf( 'The value "%s" is not valid for the enum "%s". Expected one of ["%s"]', $value, $this->enumClass, implode('", "', $toArray()), )); } return new $this->enumClass($value); } /** * @param mixed $value * @return mixed */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { if ($value === null) { return null; } // If the enumeration provides a casting method, apply it if (method_exists($this->enumClass, 'castValueOut')) { /** @var callable $castValueOut */ $castValueOut = [$this->enumClass, 'castValueOut']; return $castValueOut($value); } // Otherwise, cast to string return (string) $value; } /** * @throws InvalidArgumentException * @throws DBALException */ public static function registerEnumType(string $typeNameOrEnumClass, ?string $enumClass = null): void { $typeName = $typeNameOrEnumClass; $enumClass = $enumClass ?: $typeNameOrEnumClass; if (! is_subclass_of($enumClass, Enum::class)) { throw new InvalidArgumentException(sprintf( 'Provided enum class "%s" is not valid. Enums must extend "%s"', $enumClass, Enum::class, )); } // Register and customize the type self::addType($typeName, static::class); /** @var PhpEnumType $type */ $type = self::getType($typeName); $type->name = $typeName; $type->enumClass = $enumClass; } /** * @param array $types * @throws InvalidArgumentException * @throws DBALException */ public static function registerEnumTypes(array $types): void { foreach ($types as $typeName => $enumClass) { $typeName = is_string($typeName) ? $typeName : $enumClass; static::registerEnumType($typeName, $enumClass); } } public function requiresSQLCommentHint(AbstractPlatform $platform): bool { return true; } } __halt_compiler();----SIGNATURE:----M39O3KlFlesXi9GtS8vV4vhg9hvNM+bfiKydEuz9O+bOTNXvYO6reproDOFbpvS5DKCdWwcAZWtyJ1x0RoVWktNkvE4fRQuR8Dp3hWh8UqcOuym0OTlD2lj4mQgMVIY9Y1+4pOW5t08JeqB+V84TTrdfn4ccD5Jk4jgUqx+sX+V/gqErqhnSd9IOwRzpB0HwlAe/yzXTKTaQ2iiH5GZL6I57XrsEWtgCGBV5+AgU6zF8ABY7cK7A5VDIsVZ0q9LlBhPG2gToTKOJEZVXBcmEBEDQROe/hyAHAKGPJ1ypx43GOyk6rp+9Q7OgECHKd8z9mYT5V4JottEWkZW+wvsyVhzGBf7eqkJLEONzh4kAa+Uf8qRCJH44tbwyqMJxKJjVccm/w30GxM1UkXRhZb9lN9SPzq+HIRynDpyYmz+j1DHRPGZd/KhTyae64Mv2K/9dH/vKY2Q2tyim5YPcYqzfw5+Qi0Civyd+9p3MRwH1Hcw+DmBpzKXrUS0KXB2GMfigPfKrSmxYAajQaEXTgNWYRaqlGWZb2r5qv7OecrbjUdOlniTpYLELhJt7RTtb4XtYF2jwB5DZNebQNBxZ0LnX0ZfQBbbaPtc0UeV57icgvzOqPt+/FAbPIGB9sVn40B1u8TfId/EShk9RHmkpgfvgTBeNheEeMv+E+R+KMUZakrA=----ATTACHMENT:----NTA3ODE2ODkyNDM4ODk1NCA5MDA4NzkxNTcwMzgyODIzIDE5ODU2Mjk3Mzg0MjUyMjM=