symfony/doctrine-bridge
Symfony Doctrine Bridge integrates Doctrine with Symfony components, providing glue code for ORM/DBAL usage across the framework. Part of the main Symfony repository; report issues and submit pull requests there.
Validator, Form, Security). For Laravel projects, this introduces a paradigm shift from Eloquent to Doctrine, requiring architectural adjustments in data access layers, migrations, and entity management.@Assert constraints align with Laravel’s validation rules but require mapping (e.g., UniqueEntity → Laravel’s unique:table,column).Form component is more opinionated than Laravel’s, potentially increasing boilerplate for dynamic forms.UserProvider and PersistentToken can replace Laravel’s Authenticatable but require custom adapters for Laravel’s session/cookie handling.prePersist) can integrate with Laravel’s event system via listeners, but sequencing may differ.laravel-doctrine) exists to abstract Symfony-specific code.Model with Doctrine’s EntityManager and Entity.doctrine/doctrine-migrations-bundle) can replace Laravel Migrations but require schema updates.EntityManager as a service).fillable/guarded must map to Doctrine’s @ORM\Column and accessors/mutators.hasMany/belongsTo → Doctrine’s @ManyToOne/OneToMany with bidirectional associations.Repository methods or DQL filters..php files vs. Symfony’s cache) could impact warm-up time.tinker/artisan equivalents (e.g., doctrine:schema:update) must be adopted.AbstractDoctrineExtension, which may affect custom bundles (though unlikely for Laravel).DatabaseTransactions) adapt?PersistentToken vs. Laravel’s remember_token)?FrameworkBundle.AppServiceProvider with Symfony’s Kernel.doctrine/orm directly with a custom container binding (e.g., EntityManager as a singleton).artisan commands).laravel-doctrine to bridge Symfony’s Doctrine with Laravel.@Assert constraints.User, Product) to Doctrine entities.DoctrineEntity trait).Validator, Form) as needed.Schema::create() with Doctrine Migrations.factory() with Symfony’s doctrine/doctrine-fixtures-bundle.tinker with Symfony’s console or a custom wrapper.| Laravel Feature | Doctrine/Symfony Equivalent | Compatibility Notes |
|---|---|---|
| Eloquent Models | Doctrine Entities (@ORM\Entity) |
Requires mapping fillable → @ORM\Column, accessors/mutators. |
| Migrations | Doctrine Migrations (doctrine/orm) |
Schema changes must be rewritten; no direct migration file conversion. |
| Query Scopes | Repository Methods or DQL Filters | Custom scopes may need refactoring into findBy* methods or QueryBuilder logic. |
| Relationships | Doctrine Associations (@ManyToOne, etc.) |
Bidirectional relationships require explicit inversedBy/mappedBy. |
| Validation | Symfony Validator (@Assert) |
Laravel’s rules() → Symfony’s @Assert\* annotations or YAML/XML config. |
| Events | Doctrine Lifecycle Events | observes() → @ORM\HasLifecycleCallbacks + @PrePersist, etc. |
| Accessors/Mutators | Doctrine Getters/Setters | Laravel’s getAttributeFormat() → Doctrine’s type hints and custom setters. |
| Soft Deletes | Doctrine SoftDeleteable |
Replace deleted_at with Doctrine’s lifecycle callbacks. |
| API Resources | Symfony Serializer |
Laravel’s ApiResource → Symfony’s Normalizer or Serializer groups. |
| Testing | Symfony TestCase |
Laravel’s RefreshDatabase → Symfony’s DatabaseTransactions or fixtures. |
How can I help you explore Laravel packages today?