- Does teamq-doctrine-behaviors work with Laravel?
- Only if your Laravel application already runs Doctrine ORM through a package such as laravel-doctrine instead of Eloquent. The library registers Doctrine event subscribers and mutates entity state at flush time, so it has no Eloquent equivalent and no awareness of Laravel's model lifecycle. If your codebase is Eloquent-first, adopting it would mean running two ORMs and two metadata pipelines, which is almost never worth it for a handful of traits.
- How do I install teamq-doctrine-behaviors in a Laravel app?
- Install it with composer require teamq-ec/teamq-doctrine-behaviors and then register the behavior event subscribers with your Doctrine EventManager, typically inside a service provider or in config/doctrine.php if you use laravel-doctrine. After that, opt in per entity by adding the relevant attributes or annotations to your entity class. There is no published README or usage guide, so plan to read the source to confirm subscriber class names and configuration keys.
- What behaviors does teamq-doctrine-behaviors include?
- The package bundles class extensions for Timestampable, Blameable, SoftDeleteable, Sluggable and Loggable. Timestampable and Blameable populate created and updated dates and user references, SoftDeleteable filters rows instead of deleting them, Sluggable generates unique slugs, and Loggable records entity change history. Treat Sluggable and Loggable as the least mature of the set, since they carry the most edge cases around concurrency and versioning.
- How do I add created_at and updated_by to a Doctrine entity in Laravel?
- Add the Timestampable and Blameable traits or attributes to the entity and make sure the matching subscribers are registered with the Doctrine EventManager. The values are written during flush rather than in your controller, so they are populated regardless of whether the write comes from HTTP, a queue worker or an artisan command. Write a quick test that inserts and updates a record in each context to confirm the columns are populated correctly.
- Is teamq-doctrine-behaviors v2.0.0 a breaking change?
- The entire v2.0.0 changelog entry is 'Upgrade version' with no migration notes, diff summary or stated breaking changes, so you cannot know from the release page alone. A 1.0.0 to 2.0.0 jump usually hides a PHP floor bump, a doctrine/orm major version, an annotation-to-attribute switch or namespace changes. Read the raw v1.0.0...v2.0.0 diff before opening an upgrade branch, and pin v1.0.0 in production until you have done so.
- Does teamq-doctrine-behaviors support PHP 8 attributes and Doctrine ORM 3?
- There is no documented answer in the published release data, and Doctrine ORM 3 removes annotation support entirely, so attribute support is mandatory if you are on ORM 3. Check the package's composer.json constraints and the subscriber implementations to see whether they read attributes, annotations, or both. If it is annotation-only, it will not work on ORM 3 without patching or forking.
- How does soft delete work in teamq-doctrine-behaviors?
- SoftDeleteable marks rows as deleted and registers a Doctrine filter so queries exclude them, rather than issuing a DELETE statement. Verify in your own tests that the filter is applied both when querying the entity directly and when it is hydrated through associations, because filters are easy to disable accidentally. Also confirm how the behavior interacts with unique constraints, since soft-deleted rows still occupy slugs and other unique values.
- Does teamq-doctrine-behaviors have tests and active maintenance?
- The release data shows a single-author package from a small services organization with no visible CI matrix or test signal, so treat the test story as unproven. The realistic risk is bus factor rather than code quality, since the library may have been extracted from a client engagement with no public API stability commitment. Read the source, run your own regression tests, and consider forking if the package becomes load-bearing for you.
- What are the alternatives to teamq-doctrine-behaviors?
- The most established option is gedmo/doctrine-extensions, which covers Timestampable, Blameable, SoftDeleteable, Sluggable, Loggable and more with a long maintenance history. If you are on Eloquent, the equivalent functionality comes from built-in timestamps, SoftDeletes, spatie/laravel-sluggable and owen-it/laravel-auditing. Choose based on your ORM rather than the feature list, because you cannot mix Eloquent traits into Doctrine entities.
- What should I test before shipping teamq-doctrine-behaviors to production?
- Behaviors mutate state at flush, so a broken subscriber fails silently by writing NULL into created_at or updated_by, or by letting soft-deleted rows back into results. Test timestamp columns on insert and update, blameable user IDs under HTTP, queue worker and CLI contexts, the soft-delete filter on direct queries and association hydration, and slug uniqueness under concurrent inserts. Also confirm the package's constraints against your lockfile with composer why and composer outdated --direct before you commit.