mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Attribute on traits #6792
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jurriaanr on GitHub (Jul 27, 2021).
Feature Request
There was a question/discussion before about annotations on traits (f.e. the HasLifecycleCallbacks annotation):
https://github.com/doctrine/orm/pull/1517
The same thing would now apply to attributes. Right now using an attribute on a trait does not seem to work:
Right now the attribute needs to be on the Entity using the trait. Following the same principle as the above annotation example attributes on a trait should be parsed as well.
Summary
parse attributes on trait as if they were on class
@Safranil commented on GitHub (Sep 22, 2021):
Hi,
I need the same. I have a trait for an UUID that is generated at persist time and it would be useful to set the
HasLifecycleCallbacksAttribute/Annotation on the trait instead of all classes using this trait.@derrabus commented on GitHub (Sep 22, 2021):
TIL: You can have attributes on traits. 🤯
@e-vural commented on GitHub (Nov 14, 2022):
I am working on symfony 6 and php 8. If i use trait inside entity, columns dont show in db. But when i use php 7.4 , i have no problem.

created_at and updated_at columns don't show when i force db.
@e-vural commented on GitHub (Nov 14, 2022):
I found the problem. https://github.com/symfony/symfony/issues/46003#issuecomment-1313228905