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:----jfmTVVY2CoIADcLCjuxuBTNGUmWTHe31rTRAUDSBxw+sflaNC8yImatc/LulGMcD4UTbsVBotRQPvO+DVnM8gDGM2wEKLy36T6DC2t4aO9yiIwEez0BfzgusyVVBqXW2eDySCNDC8hmHzjNi83vkSs/eRKA76s0ZDaXSc3aF5DCntrjqh3D7KumHwADb1/ZqisixP2hemQe+/YdcFehGkKSbifs/Q5jKHv9Aj/hgTSAOQ/Ji7ey6Sb6PmvXvKJjFrZ7TFVoomUHtX89N2H9hzbsjr/XkbQxiyyg6jQWNDgSnfjAoqujw6Z3P7AWfH+kTK4J0cytJfCrYg2eLHHwOFEpDa+QW8l9gfSbLeEAIOo6mRfeLw4UN73p0mlSJXOQnw0OCEUTlPavFBesuCCPQPJI6YaePd/aEP0dQKF/bGm5ijdFy/3sJjV0lz14RNtyumkb7MA0LODmMhv3nmaSt+Tb18OVcpCHhwyksO3s9SX5zIxTL6puzGSu5jOerhKTCOIym1YZM8UZXIlwklP/epVU4wa9UjeNcw4dXWz+8TAT2ExzJrb/UTKV0kQpnhvKhsRcJfWQiwVj3HnyeztmfXOOYkSNdjmQkYvSWIzVm2BpfDjYSAUDjildfR9EsgbY1t+lkDsv050Y/MN2m+gwEUI/yKPFt0PQJPR1TCQJuhPM=----ATTACHMENT:----ODIwMTMwNTA4ODI4ODQyNSAyNTczMDI2NzI2NDQxODM2IDI3Nzk2NTQzMzA0OTU2MzU=