- Can I use acelaya/doctrine-enum-type in a pure Laravel/Eloquent app without Doctrine?
- No, this package requires Doctrine ORM. If you're using Eloquent, consider Spatie’s Laravel Enums or PHP 8.1’s native enums instead. Only adopt Doctrine (via spatie/laravel-doctrine) if you need its advanced features like DDD or complex queries.
- Does this package support PHP 8.1+ native enums?
- No, it relies on the deprecated myclabs/php-enum. For PHP 8.1+, use Doctrine’s built-in enum support or alternatives like ramsey/uuid-style enums. This package is now largely obsolete for modern Laravel setups.
- How do I install acelaya/doctrine-enum-type with Laravel and Doctrine?
- Run `composer require acelaya/doctrine-enum-type` and ensure Doctrine ORM is installed (e.g., via spatie/laravel-doctrine). Configure Doctrine in your `config/doctrine.php` to register the `PhpEnumType` for your enum fields.
- Will this work with Doctrine DBAL 3.0 and Symfony 6.x?
- Yes, the package now supports Doctrine DBAL 3.0, making it compatible with Symfony 6.x or Laravel apps using spatie/laravel-doctrine. However, test thoroughly with your specific Doctrine ORM version (e.g., 2.10 vs. 3.x).
- Can I use dynamic enums (runtime-defined values) with this package?
- No, this package requires enums to be predefined in the database (e.g., MySQL ENUM columns). Dynamic enums won’t work—use application-level validation with VARCHAR columns instead.
- What databases support this package’s enum mapping?
- MySQL and PostgreSQL support native ENUM types, so they work seamlessly. SQLite has limited ENUM support (use TEXT + validation), and SQL Server requires VARCHAR with app-level checks.
- Is acelaya/doctrine-enum-type actively maintained?
- No, the package was archived in 2021. While it now supports DBAL 3.0, there are no guarantees for future PHP 8.x/Doctrine 3.x compatibility. Consider maintained alternatives like doctrine/doctrine-enum-bundle for long-term projects.
- How do I migrate from Eloquent enums to Doctrine enums with this package?
- Audit your Eloquent models for enum usage, then refactor entities to use Doctrine. Update migrations to define ENUM columns, and replace model properties with Doctrine-mapped enums. Test queries and repositories thoroughly.
- Are there performance overheads for enum hydration/dehydration?
- Yes, there’s minor overhead compared to native types. Benchmark in high-throughput systems, especially if enums are used frequently. For critical paths, consider native PHP 8.1 enums or simpler VARCHAR columns.
- Does this package integrate with Laravel’s IDE tools (e.g., PHPStorm autocompletion)?
- No, IDE support is limited. You’ll need manual type hints for enums. For better tooling, use PHP 8.1 native enums or Spatie’s Laravel Enums, which integrate seamlessly with modern IDEs.