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) // phpcs:ignore { 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:----oJtIIEcLZ6Rso1Gx9NDYsDbzsOf7d1f4Qz5uR+3TrsgLTQJXGqsLPFCKNIFqKSf3VZAvWTJruqZ0Rt7oxDX9q5QE/9cUsmlfc5wlGbPmSGCkhODJOVTh0oapXytu/7Lqqm3/mAhhpTiFJ+aUfF2zA8ryM5W5FUvQ7LA7/9qJIGJEZ9y8mWNcrr+LpL5vXrIZuTtSemrwU5id4DgSvCQpo4GdLdoS1+RUtzPJhJ0BEiUt7/PdYRxBJchGKVoyvXiw3ic8aWFv1bqgKjOElS7F2HFE3E8WC/JH7H5ujOk2hZa4cpdL4pWE4NcuSoQjpPVQ8bbgzE3gcNg48h5hN7xICRWjmmi5Lfq4xh9Ol4A3NUsR8JxaPQELaWvBEzEeLUb4Ih17mzc3mI+ABvCO93Cju3WnmHi0puogGc1J+D7ShHSOtObdeiJcPYKXQY87A8oMBDUESaYd0iNPoMJBnYwVPK7uGejIBSrXzl/tsAHxo5S1cIvuPwJONnYVc6MbWdy4PNRuhA/P7JZOv1vFXY51s7/2Fz/+Phq3suXMeQWqtFMgi8fY61dreJEvPIYh5xa+IpmtunQibyIY8pw5zHVTsRHmKz7XG0X0EzkRW66lnav+hwcdBhU+gWS0BNVBcxzfB1m3P1gB9bEeZvflW66Z5ArCzHLihWJZ3JwmMXhOpxA=----ATTACHMENT:----NTYwNjAyMzQyMjgxMjk2MiAyNjk0ODc2MDYxMzk5MDYwIDgxOTEwMzE2MTYzMDI5NjU=