-
-
Notifications
You must be signed in to change notification settings - Fork 421
[make:entity] add php8 attribute support #920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[make:entity] add php8 attribute support #920
Conversation
This patch accounts for the negative return value of substr_compare when the two strings are totally different.
Working fine to me! There is something i can do to help getting it merged? 🙌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@SimonMarx can you rebase this against the main branch so we can see what the tests look like? thanks in advance! |
This change contains a bug in the Mapping Driver resolution that will return the wrong driver when multiple drivers are in place. I've submitted a pull request to @SimonMarx 's branch here: SimonMarx#2 I'd suggest getting that one through before rebasing and merging this one. |
…-support Added attribute mapping detection
…upport Fix Mapping Driver guesser for new entities
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, tests are green and this is close! I've left some comments for things we should fix before merge - I think @jrushlow is going to keep pushing this across the finish line, but @SimonMarx you've been wonderful on this PR, so if you have some time, just coordinate with jrushlow so you don't both do the work. And thanks again!
src/DependencyInjection/CompilerPass/DoctrineAttributesCheckPass.php
Outdated
Show resolved
Hide resolved
true, | ||
!$useAttributesForDoctrineMapping, | ||
true, | ||
$useAttributesForDoctrineMapping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This constructor is complex, in large part because that nasty, confusing 3rd argument (which is my fault).
Anyways, I've seen this twice so far and it gave me an idea: add a DoctrineHelper::createClassSourceManipulator(string $className)
method that handles all of this ugliness for us.
@SimonMarx I noticed there are 2 of other committers on this PR (besides @jrushlow and I). Can you explain who they are?
I figured it out 😄 |
@SimonMarx - Also, see #978 for a cleaned up version of this PR, I need your "ok" on that PR ( Thanks! |
This PR was merged into the 1.0-dev branch. Discussion ---------- Adding Entity attribute support Hi! This is #920 cleaned up. Somehow, in that PR, the commits got tanged. For example, some commits were done twice, like SimonMarx@d12c2f9 and SimonMarx@3848f4f - but the bigger problem is that some commits (like the 2nd listed) have one date on GitHub (e.g. Aug 12th) but another date when pulled down locally (July 4th). Whatever is causing this seems to also cause, during a rebase, for these commits to be rebased on reverse. In short, it was an odd mess. To fix this, I've created a single commit with co-authors. I need to verify that this is ok with `@SimonMarx` and determine where these other two contributors came from :) (see #920 (comment)) Cheers! ``` Co-authored-by: Simon Marx <[email protected]> Co-authored-by: Morgan ABRAHAM <[email protected]> Co-authored-by: Adria Lopez <[email protected]> Co-authored-by: Jesse Rushlow <[email protected]> ``` Commits ------- 9ecc684 Adding Entity attribute support
Hey everyone,
i saw the open issue #892 and i had the same problem.
Since my application is running on php8 and i do not want to create all my entities manually, i've added attribute support for the
make:entity
command.The Annotation support is still available and (i think) untouched.
Things I was / am unsure about:
isAttributed
, or decide which kind of manipulation strategy the ClassSourceManipulator should use (annotation or attribute) depending on the given MappingDriver. As you can see in the code, i selected option number 2.DoctrineHelper::isClassAnnotated
is theoretically not needed anymore. But removing public methods is forbidden, do i have to flag/annotate them somehow in the doc blocks?make:user
does not support Attributes now, should that logic be implemented in this Pull Request?To be honest, this is my first public pull request and im a bit nervous 😰 . I tried to follow all rules from the contributing guidelines, but maybe i missed some rules, so I am grateful for any feedback, tips, dos and don'ts.
Thanks in advance for your feedbacks and here is a screenshot of an generated entity with attributes 😃