{"id":15025489,"url":"https://github.com/neutron-pro/doctrine-enum-php-type","last_synced_at":"2026-04-04T13:39:55.193Z","repository":{"id":57025781,"uuid":"384241846","full_name":"Neutron-Pro/doctrine-enum-php-type","owner":"Neutron-Pro","description":"Added a doctrine type for the php enumeration system designed to be as close as possible to PHP 8.1 for earlier versions.","archived":false,"fork":false,"pushed_at":"2021-07-09T21:06:02.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-03-13T01:41:24.558Z","etag":null,"topics":["doctrine","doctrine-orm","php","php-enum","php7","php71","php72","php73","php74","php8","symfony"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Neutron-Pro.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-08T20:33:04.000Z","updated_at":"2021-07-09T21:02:51.000Z","dependencies_parsed_at":"2022-08-23T15:00:13.989Z","dependency_job_id":null,"html_url":"https://github.com/Neutron-Pro/doctrine-enum-php-type","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neutron-Pro%2Fdoctrine-enum-php-type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neutron-Pro%2Fdoctrine-enum-php-type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neutron-Pro%2Fdoctrine-enum-php-type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neutron-Pro%2Fdoctrine-enum-php-type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Neutron-Pro","download_url":"https://codeload.github.com/Neutron-Pro/doctrine-enum-php-type/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243324270,"owners_count":20273099,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["doctrine","doctrine-orm","php","php-enum","php7","php71","php72","php73","php74","php8","symfony"],"created_at":"2024-09-24T20:02:27.243Z","updated_at":"2025-12-28T13:20:27.758Z","avatar_url":"https://github.com/Neutron-Pro.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Doctrine Enum PHP Type\n\n---\n\n## Read the enum php doc:\n\n\u003e https://github.com/Neutron-Pro/enum-php\n\n---\n\n## Installation\n\n`composer require neutronstars/doctrine-enum-php-type`\n\n---\n\n## Doctrine Configuration\n\nIf you use it, you must create a Type class for your enum:\n\n```php\nnamespace App\\Types;\n\nclass MyEnumType extends \\NeutronStars\\Enum\\Types\\EnumType {\n  public const MY_ENUM = 'my_enum';\n  \n  public function getName(): string\n  {\n    return self::MY_ENUM;\n  }\n  \n  public function convertToPHPValue($value,\\Doctrine\\DBAL\\Platforms\\AbstractPlatform $platform): MyEnum\n  {\n    return MyEnum::from($value);\n  }\n}\n```\n\nYou must add this to the `doctrine.yaml` configuration file:\n\n```yml\ndoctrine:\n  dbal:\n    types:\n      my_enum:\n        class: App\\Types\\MyEnumType\n```\n\n\nOn the annotation that contains the field of your entity, you must put the type:\n\n```php\n/**\n * @ORM\\Column(type=\"my_enum\")\n * @var MyEnum|null\n */\nprivate ?MyEnum $myEnum;\n```\n\nyou must comment out the column that contains the enum during your sql migration:\n\n```php\n$this-\u003eaddSql('COMMENT ON COLUMN \"your_table\".\"your_column\" IS \\'(DC2Type:my_enum)\\';');\n```\n\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneutron-pro%2Fdoctrine-enum-php-type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneutron-pro%2Fdoctrine-enum-php-type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneutron-pro%2Fdoctrine-enum-php-type/lists"}