Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
Signed-off-by: alexmerlin <[email protected]>
  • Loading branch information
alexmerlin committed Oct 30, 2024
1 parent 2a9bc5f commit 3d43912
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/App/src/DBAL/Types/AbstractEnumType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use InvalidArgumentException;

use function array_map;
use function assert;
use function gettype;
use function implode;
use function is_object;
Expand All @@ -36,10 +35,7 @@ public function convertToPHPValue(mixed $value, AbstractPlatform $platform): mix
return null;
}

$enum = $this->getEnumClass();
assert($enum instanceof BackedEnum);

return $enum::from($value);
return $this->getEnumClass()::from($value);
}

public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform): mixed
Expand All @@ -59,13 +55,13 @@ public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform)
return $value->value;
}

/**
* @return class-string
*/
abstract protected function getEnumClass(): string;

private function getEnumValues(): array
{
$enum = $this->getEnumClass();
assert($enum instanceof BackedEnum);

return $enum::cases();
return $this->getEnumClass()::cases();
}
}

0 comments on commit 3d43912

Please sign in to comment.