Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Doctrine Orm Trait

Doctrine Orm Trait Laravel Package

setono/doctrine-orm-trait

Setono Doctrine ORM Trait provides reusable PHP traits for Doctrine entities, adding common behaviour like timestamps and identifiers with minimal boilerplate. Drop the traits into your entity classes to cut repetitive mapping code and keep models clean and consistent.

Deep Wiki
Context7

setono/doctrine-orm-trait provides a set of reusable traits that remove boilerplate from your Doctrine ORM entities. Instead of repeating identifiers, timestamps, and lifecycle logic in every model, drop in a trait and let Doctrine's event system do the work — keeping entities small, consistent, and easy to maintain.

  • Ready-made timestampable behavior (createdAt / updatedAt)
  • Consistent identifier and primary-key handling
  • Soft-delete support without custom base classes
  • Doctrine lifecycle callbacks wired automatically
  • Framework-agnostic — works in Symfony, Laravel, and plain PHP
Frequently asked questions about Doctrine Orm Trait
What does setono/doctrine-orm-trait do?
It provides a small reusable PHP trait for Doctrine ORM entities. The trait helps you get the object manager and repository for a given class, reducing repetitive boilerplate in Doctrine models. It is a lightweight utility rather than a full ORM replacement.
How do I install setono/doctrine-orm-trait with Composer?
Install it as a Composer dependency using composer require setono/doctrine-orm-trait. Then include the package trait in your Doctrine entity or supporting class. Confirm the exact namespace and method names in the installed source or README, since the provided excerpt does not list them.
Does setono/doctrine-orm-trait work with Laravel?
Yes, it can be used in Laravel applications that use Doctrine ORM rather than only Eloquent. Laravel does not include Doctrine ORM by default, so your app must already have Doctrine configured. The trait is framework-agnostic and fits into Laravel Doctrine setups.
Which Laravel versions are supported by this package?
The provided package context does not specify Laravel version constraints. Check the package composer.json for PHP and Laravel compatibility before installing it in a specific project. In general, the trait should work wherever your Laravel app runs a compatible Doctrine ORM version.
How do I use the trait in a Doctrine entity?
Add the package trait to your Doctrine entity or a related class with a use statement. Then call its helper methods to access the object manager and repository. Keep your existing Doctrine mappings and entity fields unchanged, and verify the exact trait namespace from the installed package.
How does it get the repository for a given class?
The trait is designed to resolve the Doctrine object manager and repository for a class so you do not repeat that lookup code. You pass or reference the target entity class and use the returned repository for queries. Check the package source for the precise method signatures and return types.
Can I use setono/doctrine-orm-trait outside Laravel?
Yes, the trait is for Doctrine ORM and is not tied to Laravel. It can be used in any PHP project with Doctrine ORM configured. Laravel is mentioned here because many developers evaluate it in Laravel Doctrine applications.
Does the package require configuration or service registration?
The context describes a lightweight trait, so it likely does not need a service provider or special Laravel configuration. You normally just install it and use the trait in your class. Confirm any required Doctrine setup in your application, especially how the object manager is made available.
Is setono/doctrine-orm-trait safe for production use?
It is a small utility trait, so production suitability depends mainly on your Doctrine setup and testing. Add it to a test branch, verify the helper methods behave as expected, and run your entity and repository tests. Avoid relying on undocumented behavior if the package source is unclear.
Are there alternatives to using this Doctrine ORM trait?
You can write your own trait or base class to fetch the Doctrine object manager and repository for an entity. Another common approach is injecting EntityManagerInterface and resolving repositories explicitly in services. This package is simply a reusable shortcut for that boilerplate.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections