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:----HJIUO+5karSiBcOiyFGRB/JjU/YIhGCZmZc/FG9o4twM+qZ97nvAW8zE+04RkWHyGDyAA+DjuacllO10YpN21NppdYy4CGmh33tgeme9SXMj9GPIG09o6n3dp3a/bqdjqwmnlAPdgXQQMbMgPZByf8y2o3bt+xc9xvou2r8AyqRNqUhhih88a/GqaKa6hKmvr6nJJn1Z+qKiir92HPXiZJ12vjz2aCAcYzGcnj72dJx/z512iC83G+dz2YI3YuVHz17FsjkzHgmiuWy+U4WxZdnERIZYNqJVx022yW2O3cZ/Hm+vlpe0Puw5EMb4/RQCJCbdFHqEx10WHi5TQUglcxwiLeaXMpH3GnsoIa1HWdH0jq1l/xIxFCxHuxu57dsJ1rdTbaLLmW2AUCcpi2qnJQ54Ip3xgsUsU+XF77ACts6QN6anFMCG6HPOLJVlGR1H8gSWuFMWvQjXKNE2UsnqXSAP+zLtlr5TN8e/ntz6xWGfiJIg9OGUBZp/96POtfoeCgV8SOxPEt3mPeqj8t92qnZsgfbxigCoKJ/wFeeLeiZTK5pPYB6aO68k15rvQSIFISmI38LU6meq40Et41EXYjpXmdxPr5QQnT51GEHVWDjZlr2bpqkLjcRJcqM1VSp2QgA2WSd+U2FIf7yjjSbeNCb7Jo8bRkOqIa1UJYDfYYU=----ATTACHMENT:----MjU3NDIxMTIxNTE1NjAyNCAyODEzNDQ2NjUwMTM3NDcxIDI0NjkwNzQwNDM4NjU3MjU=