ali/doctrine-extensions-bundle
Sluggable, Loggable, Translatable, Uploadable, Tree, SoftDelete), which are highly complementary to Laravel’s Eloquent ORM philosophy (e.g., soft deletes, timestamps, tree structures). However, Laravel’s native solutions (e.g., SoftDeletes, Timestamps, Scout for search) may overlap, requiring careful evaluation of redundancy.doctrine/orm) could theoretically adopt these behaviors, but native Laravel solutions may suffice for most use cases.Blameable, Timestampable), which may conflict with Laravel’s event system (e.g., Model::boot()). Potential for duplicate logic if both Laravel and Doctrine events are used.doctrine/orm package) alongside Eloquent. This is non-trivial and may introduce maintenance complexity (e.g., dual ORM support).SoftDeletes trait vs. Gedmo’s SoftDeleteable → Potential for query conflicts (e.g., deleted_at vs. isDeleted).Timestamps vs. Gedmo’s Timestampable → Redundant if using both.filesystem + StoringFile vs. Gedmo’s Uploadable → Different paradigms (Laravel favors local/S3 storage; Gedmo is filesystem-agnostic).dev-feature/mongodb-odm-2.0 dependency suggests instability in core functionality.spatie/laravel-activitylog, spatie/laravel-medialibrary) achieve the same goals with lower risk?doctrine/orm package) alongside Eloquent (hybrid approach).symfony/event-dispatcher, symfony/dependency-injection) for bundle compatibility.ContainerInterface, Config, and EventDispatcher. Workarounds:
Model::dispatch() or Event facade.Extension class must be adapted for Laravel’s config() system.gedmo/doctrine-extensions and ali/doctrine-extensions-bundle in a new Laravel project.Sluggable, Loggable) with a sample entity.SoftDeletes).doctrine/orm + custom EntityManager).DoctrineExtensionsBundle Service Provider:
use Ali\DoctrineExtensionsBundle\AliDoctrineExtensionsBundle;
use Doctrine\ORM\Tools\Setup;
class DoctrineExtensionsServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->singleton('doctrine.extensions', function () {
$config = Setup::createAnnotationMetadataConfiguration(
[__DIR__.'/../src/Entity'],
true,
null,
null,
false
);
$entityManager = EntityManager::create(['url' => env('DB_DSN')], $config);
$bundle = new AliDoctrineExtensionsBundle();
$bundle->build($entityManager);
return $bundle;
});
}
}
@Gedmo\SoftDeleteable instead of SoftDeletes).use Gedmo\Mapping\Annotation as Gedmo;
/**
* @Gedmo\SoftDeleteable(fieldName="isDeleted", timeAware=false)
*/
class Post extends \Doctrine\ORM\Mapping\Entity
{
// ...
}
// Symfony Event (e.g., prePersist)
$dispatcher->addListener(Events::prePersist, function ($event) {
$entity = $event->getObject();
// ...
});
// Laravel Equivalent
Model::prePersist(function ($model) {
// ...
});
| Feature | Laravel Native | Gedmo Bundle | Integration Notes |
|---|---|---|---|
| Soft Deletes | SoftDeletes |
SoftDeleteable |
Conflict: Use one or the other. |
| Timestamps | Timestamps |
Timestampable |
Overlap: Configure to avoid duplication. |
| Slug Generation | spatie/laravel-sluggable |
Sluggable |
Bundle may offer more control. |
| Upload Handling | StoringFile |
Uploadable |
Different storage paradigms. |
| Tree Structures | kalnoy/nestedset |
Tree |
Bundle may support materialized paths. |
| Audit Logging | spatie/laravel-activitylog |
Loggable |
Bundle integrates with Doctrine events. |
Sluggable, Loggable).SoftDeletes last).Model::create([...])) before full adoption.How can I help you explore Laravel packages today?