Make use of DocBlock var annotation in annotation mappings #6224

Closed
opened 2026-01-22 15:29:10 +01:00 by admin · 3 comments
Owner

Originally created by @goatfryed on GitHub (Apr 15, 2019).

Feature Request

Use type provided by @var annotation as fallback, if type of column or targetEntity of relation is not defined

Q A
New Feature yes
RFC yes
BC Break yes

Summary

While writing my entity annotations today, I suddenly wondered: Why can't we use the DocBlock var Annotations as default value for column type definition and targetEntity of relation mappings? In a lot of cases, they just duplicate each other.

I searched for similiar feature requests, but haven't found one. Are there any notable concerns against using another annotation as a default?

Edit

Currently, the default value of Column::type is string, even though it is defined as mandatory in the documentation. So changing the behavior would be a BC Break, I guess.

Originally created by @goatfryed on GitHub (Apr 15, 2019). ### Feature Request #### Use type provided by `@var` annotation as fallback, if type of column or targetEntity of relation is not defined | Q | A |------------ | ------ | New Feature | yes | RFC | yes | BC Break | yes #### Summary While writing my entity annotations today, I suddenly wondered: Why can't we use the DocBlock var Annotations as default value for column type definition and targetEntity of relation mappings? In a lot of cases, they just duplicate each other. I searched for similiar feature requests, but haven't found one. Are there any notable concerns against using another annotation as a default? #### Edit Currently, the default value of Column::type is string, even though it is defined as mandatory in the documentation. So changing the behavior would be a BC Break, I guess.
admin added the New FeatureQuestion labels 2026-01-22 15:29:10 +01:00
admin closed this issue 2026-01-22 15:29:10 +01:00
Author
Owner

@Ocramius commented on GitHub (Apr 15, 2019):

@goatfryed it would probably be more interesting to use typed properties from PHP 7.4 in master, at this point

@Ocramius commented on GitHub (Apr 15, 2019): @goatfryed it would probably be more interesting to use typed properties from PHP 7.4 in `master`, at this point
Author
Owner

@psfpro commented on GitHub (Apr 27, 2019):

And why YAML driver is deprecated? I don't want to write XML

@psfpro commented on GitHub (Apr 27, 2019): And why YAML driver is deprecated? I don't want to write XML
Author
Owner

@Ocramius commented on GitHub (Apr 27, 2019):

Here's a write-up on that: https://github.com/doctrine/DoctrineBundle/issues/776#issuecomment-363812362

@Ocramius commented on GitHub (Apr 27, 2019): Here's a write-up on that: https://github.com/doctrine/DoctrineBundle/issues/776#issuecomment-363812362
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6224