Skip to content
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

Better feature detection for DoctrineExtractor #884

Closed
wants to merge 1 commit into from

Conversation

dunglas
Copy link
Contributor

@dunglas dunglas commented Dec 3, 2018

Fixes #883

@dunglas dunglas mentioned this pull request Dec 3, 2018
@kimhemsoe
Copy link
Member

@dunglas Alot of tests failing, you have an what is going on?

@alcaeus
Copy link
Member

alcaeus commented Dec 4, 2018

@kimhemsoe I believe #882 should fix them.

@dunglas
Copy link
Contributor Author

dunglas commented Dec 4, 2018

@alcaeus not totally, I use PHP features that aren't supported by PHP5. I need to take a deeper look

@alcaeus
Copy link
Member

alcaeus commented Jan 7, 2019

@dunglas Could you give this another look please?

@greg0ire
Copy link
Member

greg0ire commented Jan 7, 2019

@dunglas php 5 seems to have been dropped since you started working on this, let me restart the build :)

"php": "^7.1",

@greg0ire
Copy link
Member

greg0ire commented Jan 7, 2019

Still failing, I'm afraid you will have to rebase.

@alcaeus
Copy link
Member

alcaeus commented Jan 7, 2019

@greg0ire This fix should go into 1.10.x, where we still have 5.5. That is unless @doctrine/team-symfony-integration agrees that we can leave this as is for 1.10?

@greg0ire
Copy link
Member

greg0ire commented Jan 7, 2019

That would mean red builds on that branch, or dropping php 5 there

@alcaeus
Copy link
Member

alcaeus commented Jan 7, 2019

With "as is" I meant "as is in 1.10.x currently", not "as is in this PR". It's probably best to completely fix it in 1.10.x as well though.

@xabbuh xabbuh changed the base branch from master to 1.10.x January 7, 2019 09:39
@xabbuh
Copy link
Member

xabbuh commented Jan 7, 2019

I changed the target branch which makes the build slightly look better. But it seems that the fix still needs some work (see the failing tests).

👍 for me to release 1.10.1 without this PR (and release 1.10.2 once this one is ready).

@alcaeus
Copy link
Member

alcaeus commented Jan 7, 2019

for me to release 1.10.1 without this PR (and release 1.10.2 once this one is ready).

Yeah, thought of that as well. Will do 👍

@alcaeus
Copy link
Member

alcaeus commented Feb 3, 2019

@dunglas can you take another look at this please?

@dunglas
Copy link
Contributor Author

dunglas commented Feb 3, 2019

I'll try to take a look asap, unfortunately it's not on top of my todo list right now tbh

@alcaeus
Copy link
Member

alcaeus commented Feb 3, 2019

That's fine - I'm just not aware of what the issue is and how to fix it. Maybe @doctrine/team-symfony-integration can advise how to proceed here?

@silverbackdan
Copy link

Does this not just need a rebase now as the travis config has been updated to reflect the new php minimum requirements? I might be wrong but I think I'll try creating a PR with the new travis config and this update and see if it works to help get this resolved.

@silverbackdan
Copy link

Does this not just need a rebase now as the travis config has been updated to reflect the new php minimum requirements? I might be wrong but I think I'll try creating a PR with the new travis config and this update and see if it works to help get this resolved.

Sorry, missed the conversation regarding 1.10.x as well.

@silverbackdan
Copy link

I've just created an alternative PR where tests pass and could be merged to 1.10.x if you think it is acceptable.

@alcaeus
Copy link
Member

alcaeus commented Feb 3, 2019

Thanks @silverbackdan - I'll take a look tomorrow. @dunglas maybe you could take a quick look as well?

@alcaeus
Copy link
Member

alcaeus commented Feb 4, 2019

After taking a look, I can see why it's not at the top of your todo list. We can't reliably detect whether the Doctrine Bridge is installed in version 4.2 (or newer) by checking features. The check introduced here won't work as there is no parameter type in the DoctrineExtractor constructor, so the check will always fail.

The only check I came up with was checking the type hint of the DoctrineChoiceLoader argument (to distinguish Symfony 3 from Symfony 4) and checking for the existence of the DoctrineTransactionMiddlewareFactory class, but that matches both Symfony 4.0 and 4.2. There are no other obvious changes in the bridge that would help during version detection.

We could use a package like ocramius/package-versions to go version-based on this check, but all other checks check the code so I didn't just want to go that route.

@greg0ire
Copy link
Member

greg0ire commented Feb 4, 2019

How about using this: https://github.com/symfony/doctrine-bridge/compare/4.1...v4.2.0#diff-52766cedbcf59f925f7316471f14d51fR29 ?

Something like is_a(DoctrineType::class, ResetInterface::class, true) could work, apparently: https://3v4l.org/s0Rp9

@alcaeus
Copy link
Member

alcaeus commented Feb 4, 2019

Good catch, that would work. I'll test that later today unless somebody else wants to try it earlier.

@greg0ire
Copy link
Member

greg0ire commented Feb 4, 2019

I'm working on a PR, but will not have time to test it :P

greg0ire added a commit to greg0ire/DoctrineBundle that referenced this pull request Feb 4, 2019
Although it is in the PropertyInfo sub namespace, the DoctrineExtractor
class is in the doctrine bridge, which means we should detect the
doctrine bridge version and not the PropertyInfo component version.

Fixes doctrine#883, Closes doctrine#884
@greg0ire
Copy link
Member

greg0ire commented Feb 4, 2019

See #917

@xabbuh
Copy link
Member

xabbuh commented Feb 4, 2019

see #918

@greg0ire
Copy link
Member

greg0ire commented Feb 4, 2019

How about an approach where we detect this property: https://github.com/symfony/doctrine-bridge/compare/4.1...v4.2.0#diff-0ddb11f82d9ee9635a016dbb98a03de9R31 ? It's supported in php 5: https://secure.php.net/manual/en/reflectionclass.hasproperty.php

@xabbuh

This comment has been minimized.

@greg0ire
Copy link
Member

greg0ire commented Feb 4, 2019

BTW, I don't really understand your point, @alcaeus :

The check introduced here won't work as there is no parameter type in the DoctrineExtractor constructor, so the check will always fail.

There is a parameter type… in v 4.1 , and the code in this PR checks that.

null !== $constructorParameterType && $constructorParameterType->getName() === ClassMetadataFactory::class

This will return true when using v4.1, right?

@xabbuh told me the actual issue is with getType not existing. I'm making a PR based on my idea.

greg0ire added a commit to greg0ire/DoctrineBundle that referenced this pull request Feb 4, 2019
Although it is in the PropertyInfo sub namespace, the DoctrineExtractor
class is in the doctrine bridge, which means we should detect the
doctrine bridge version and not the PropertyInfo component version.

Fixes doctrine#883, Closes doctrine#884
@greg0ire
Copy link
Member

greg0ire commented Feb 4, 2019

I reused #917 for this

greg0ire added a commit to greg0ire/DoctrineBundle that referenced this pull request Feb 4, 2019
Although it is in the PropertyInfo sub namespace, the DoctrineExtractor
class is in the doctrine bridge, which means we should detect the
doctrine bridge version and not the PropertyInfo component version.

Fixes doctrine#883, Closes doctrine#884
greg0ire added a commit to greg0ire/DoctrineBundle that referenced this pull request Feb 4, 2019
Although it is in the PropertyInfo sub namespace, the DoctrineExtractor
class is in the doctrine bridge, which means we should detect the
doctrine bridge version and not the PropertyInfo component version.

Fixes doctrine#883, Closes doctrine#884
@alcaeus
Copy link
Member

alcaeus commented Feb 5, 2019

Closing in favour of #917.

@alcaeus alcaeus closed this Feb 5, 2019
@alcaeus alcaeus removed this from the 1.10.2 milestone Feb 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants