anh/doctrine-extensions-resource
Pros:
[isPublished]) mirrors Laravel’s policy/authorization patterns but at the repository level.Route::resource) and API controllers.Cons:
EventDispatcher, and ResourceManagerFactory are Symfony components, requiring Laravel equivalents (e.g., Illuminate\Events\Dispatcher).EntityManager → Laravel’s Illuminate\Database\DatabaseManager.EventDispatcher → Laravel’s Illuminate\Events\Dispatcher.QueryBuilder syntax.LengthAwarePaginator vs. Doctrine’s PaginatorInterface.anh_resource.article.pre_create) to Laravel events (e.g., model.created).Why not use Eloquent’s built-in features?
#or, #and) or rule-based filtering, this could justify the effort.What’s the scope of integration?
How will events be handled?
model.saving, model.saved, etc.?Pagination strategy:
Paginator or adapt Doctrine’s ResourcePaginatorInterface?Authorization:
Performance trade-offs:
Long-term maintenance:
Illuminate\Events\Dispatcher as a drop-in replacement for Symfony’s.AppServiceProvider).spatie/laravel-doctrine-orm).Phase 1: Proof of Concept
ResourceManager in a Laravel service with Eloquent models.class LaravelResourceManager
{
public function __construct(private ResourceManager $resourceManager) {}
public function create(string $resourceName, array $data): Model
{
$entity = $this->resourceManager->create($resourceName);
// Map data to entity...
$this->resourceManager->create($entity);
return $entity;
}
}
Article).Phase 2: Event System Integration
| Symfony Event | Laravel Equivalent |
|---|---|
anh_resource.article.pre_create |
model.creating: Article |
anh_resource.article.post_save |
model.saved: Article |
Event::listen() or Observer pattern.Phase 3: Query Builder Adaptation
QueryBuilder with Eloquent’s:
%rating > 10) to Eloquent queries.// Doctrine criteria
$criteria = ['%rating' => ['>' => 10]];
// Eloquent equivalent
Model::where('rating', '>', 10)->get();
#or, #and, auto-joins) via custom query builder logic.Phase 4: Full Integration
ResourceRepository where needed.find(), first(), etc., won’t work directly with ResourceRepository. Requires custom facade or trait.spatie/laravel-doctrine-orm).EventDispatcher) if not using Laravel’s equivalents.Post).ResourceManager and ResourceRepository.QueryBuilder, repositories) even if using Eloquent.%rating > 10, #or).How can I help you explore Laravel packages today?