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:----IFmzEiRnLXSd6sd+5kqpHW0Cm6DnHw22n8rzXuKmKtNvPhP7/Ht0DKOHC3upF0wHBY5/Nc8NXlJ47MwrBjvrYHopdHPk5lVnpPsTNwac0FZLx5id7C5rYNfkbWNuxdBPiCN2/7tHkSBbcWCFW7G1OQxLixX2WFEUesBcoPBfw/CU8Op1x6cJqAsleLx5w9nQH5YTXIMylbH4Pw5TusGVp9iYdevwnQmb5V5XFp3QoOKIYhC8cx4hcDZEFQqDZ81A0ZJmeaqDdiPSTGd/yHOAssNyEyQjKQE4ESbADzo1ybjwy5k8kyUHeCTW1utX5EIQ7gzF6Vcl6czEr0N0O/5q41KEay3j7t8eL4WyJvxEgzzeqvZEBCVRrWcj0rsm/nJIRXx8Ac6jIJtZGo4IyzL4vpBG0x/6WustAqM4MB18bW9NuF75qNHZsRfkYPePNMMPziLTsm0QPkETxPJzFfmC8B33O33xO8VsW7hONIdY7KPZncl5EOcpFXvEdNMgF3G0bKudCuyWlYRJhb+fwf4MskScFMJijJfXBfrsKytnvZ+wZYooGbMqbfX6ASKG3Pq3mMaKx7g3a3HolfRVARgqMzp3AQjBTROjfcR0GVyLL+pfJlH2KoFz1sXPU5tHq9oDgBAM+80Yv9dGmHrm1nUTDJCE7J+THBxKptUz6QXCcX4=----ATTACHMENT:----NTkxMjg1NzA5MjM2OTUyMyAxOTQ2MTQ2MjEyMzQ4NTQ1IDkxOTU0OTE2Nzk1NDg3MDg=