doctrine / doctrine/annotations

Referencing self:: constants in annotations

Open
#269 5 comments 4 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
6.7k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

At the moment constant parsing doesn't read `self::` constants and I have a use case where that would be the most practical solution:
I would like to pass serialization groups for a property that's defined in a trait. Since not all entities will have the same serialization groups for the properties in the traits, the only currently available options that I see is to either repeat the property definition in each entity or repeat the groups serialization definition for each property and each entity in yaml/xml.

I would have created a PR instead of an issue for this, but from what I see in the DocParser class, the only way to get the original class name would be to parse the context string, which seems like a bad idea. I'm hoping that someone more familiar with the codebase could do it in a cleaner way. If there isn't a better way, please let me know and I'll make a PR.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.