- Can RowcastBundle replace Doctrine in a Laravel application?
- RowcastBundle is designed for Symfony, not Laravel, so it won’t work directly in Laravel projects. However, its core library (`ascetic-soft/rowcast`) could be adapted for Laravel via Composer dependencies, though you’d need to handle Symfony-specific components (like DI or Console) manually. For Laravel, consider alternatives like Eloquent or Query Builder for native integration.
- What Laravel versions does RowcastBundle support?
- RowcastBundle is built for Symfony 7.x+, not Laravel. However, its underlying library (`ascetic-soft/rowcast`) supports PHP 8.4+, which aligns with Laravel 10+. If you need a similar solution for Laravel, explore packages like `spatie/laravel-query-builder` or `doctrine/dbal` for database abstraction without full ORM overhead.
- How do I configure database connections in RowcastBundle?
- Configuration is done via `config/packages/rowcast.yaml` in Symfony. Define your DSN, credentials, and options under `rowcast.connection`. For example, use `%env(DATABASE_URL)%` for environment variables. Transactions and nesting are configurable via `nest_transactions`. Ensure your `.env` file contains the required database credentials.
- Does RowcastBundle support migrations like Doctrine?
- Yes, via the optional `ascetic-soft/rowcast-schema` component. It generates database-agnostic migrations (stored in `migrations_path`) and includes CLI commands like `rowcast:migrate`. However, it lacks advanced features like multi-environment migrations or conditional diffs, so complex schemas may require manual SQL.
- How does RowcastBundle handle SQL profiling in development?
- RowcastBundle integrates with Symfony’s Web Profiler to log slow queries (configurable via `slow_query_threshold_ms`). Enable it in `rowcast.profiler` and install `ascetic-soft/rowcast-profiler` and `symfony/framework-bundle`. This provides query-level insights without production overhead, similar to Doctrine’s profiler but lighter.
- Is RowcastBundle suitable for high-traffic APIs?
- Yes, RowcastBundle is optimized for performance with a lightweight DataMapper that avoids Doctrine’s proxy generation and event overhead. It’s ideal for CRUD-heavy APIs where type safety and speed matter. However, test under load, as its early-stage maturity means real-world benchmarks are unavailable.
- Can I use RowcastBundle with PostgreSQL-specific features like JSONB?
- RowcastBundle uses PDO under the hood, so it supports PostgreSQL, MySQL, and SQLite. However, database-specific features (e.g., JSONB, partitions) require custom implementations or raw SQL queries. The bundle’s schema system is database-agnostic, so complex DDL operations may need manual handling.
- What are the risks of adopting RowcastBundle in production?
- RowcastBundle is unproven in production due to its lack of community adoption or benchmarks. Risks include unknown stability, potential breaking changes, and limited ecosystem support (e.g., no Doctrine extensions). Pilot it in non-critical services first and monitor performance closely.
- How do I migrate from Doctrine to RowcastBundle?
- Replace `EntityManager` with `DataMapper` in your services and update repositories to use Rowcast’s query builder. Schema definitions can be converted to PHP attributes or YAML configs. However, Doctrine-specific features (e.g., Gedmo behaviors) won’t port directly, requiring custom logic or hybrid architectures.
- Are there alternatives to RowcastBundle for Laravel?
- For Laravel, consider Eloquent (built-in ORM), `doctrine/dbal` (lightweight DBAL), or `spatie/laravel-query-builder` for advanced queries. If you need schema-as-code, explore `laravel-migrations-generator` or `doctrine/migrations`. For type safety without Doctrine, `mezzio/mezzio-orm` (PHP 8.1+) or `cycle/orm` are alternatives.