- Can I use DirectBundle with Laravel instead of Symfony2?
- No, DirectBundle is designed exclusively for Symfony2 and won’t work with Laravel. Laravel developers should explore alternatives like API Platform or custom RPC layers for ExtJS integration.
- What Laravel packages offer ExtDirect support?
- There are no direct Laravel equivalents to DirectBundle. For ExtJS RPC, consider building a custom API using Laravel’s routing system or adopting GraphQL (e.g., `spatie/laravel-graphql`) for modern frontend integration.
- How do I configure DirectBundle for Doctrine query responses?
- DirectBundle supports Doctrine queries via the `reader` configuration in `extdirect_routing.yml`. Use `root: root` for array responses or specify a custom hydrator like `HYDRATE_ARRAY` to flatten nested objects.
- Does DirectBundle support Laravel’s Eloquent ORM?
- No, DirectBundle is tied to Symfony2’s Doctrine ORM. For Laravel, you’d need to manually map Eloquent queries to ExtDirect responses or use a different RPC solution.
- How do I handle form validation errors in DirectBundle?
- DirectBundle integrates with Symfony’s Form Component. Configure the `form: true` flag in routing and set an `error_template` in `config.yml` to return validation errors in ExtJS-compatible format.
- Is DirectBundle compatible with Laravel’s middleware stack?
- No, DirectBundle is Symfony2-specific and lacks Laravel’s middleware system. For Laravel, use middleware like `spatie/laravel-middleware` or build a custom RPC layer with middleware support.
- Can I use DirectBundle with Symfony 3/4/5/6?
- No, DirectBundle is limited to Symfony 2.x. For newer Symfony versions, consider rewriting the RPC logic using Symfony’s Messenger Component or API Platform.
- How do I test ExtDirect endpoints in PHPUnit?
- DirectBundle’s RPC endpoints lack a standard HTTP layer, making mocking difficult. Test controllers directly by invoking methods with hardcoded data or use ExtJS’s `Ext.direct.Manager` in frontend tests with Selenium.
- What’s the performance impact of Reflection-based routing in DirectBundle?
- Reflection adds overhead per request. For high-traffic APIs, cache routes or use a lighter router like FastRoute. Symfony’s profiler can help identify bottlenecks.
- Are there security risks using DirectBundle without CSRF protection?
- Yes, ExtDirect lacks built-in CSRF tokens. Rely on Symfony’s security layer (e.g., firewalls) and validate all inputs manually or via Symfony’s Validator Component to mitigate risks.