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

fix haveFakeRepository in the doctrine module #4212

Merged
merged 2 commits into from May 11, 2017

Conversation

Projects
None yet
3 participants
@laszlo-karpati
Contributor

laszlo-karpati commented May 11, 2017

Fix #4211

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik May 11, 2017

Member

Probably this has been working in earlier versions of Doctrine
Could you check when they did change their internal API?

Member

DavertMik commented May 11, 2017

Probably this has been working in earlier versions of Doctrine
Could you check when they did change their internal API?

@laszlo-karpati

This comment has been minimized.

Show comment
Hide comment
@laszlo-karpati

laszlo-karpati May 11, 2017

Contributor

@DavertMik I wrote about it in the connected issue as well:

they changed this part of their internal API with this commit:
doctrine/doctrine2@7eb7441

Contributor

laszlo-karpati commented May 11, 2017

@DavertMik I wrote about it in the connected issue as well:

they changed this part of their internal API with this commit:
doctrine/doctrine2@7eb7441

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik May 11, 2017

Member

Could you leave the current implementation so for not to break things for users of old Doctrine?

if ($reflectedEm->hasProperty('repositories')) {
// do stuff for old doctrine
elseif ($reflectedEm->hasProperty('repositoriyFactory') {
// do stuff for new doctrine
}
Member

DavertMik commented May 11, 2017

Could you leave the current implementation so for not to break things for users of old Doctrine?

if ($reflectedEm->hasProperty('repositories')) {
// do stuff for old doctrine
elseif ($reflectedEm->hasProperty('repositoriyFactory') {
// do stuff for new doctrine
}
@laszlo-karpati

This comment has been minimized.

Show comment
Hide comment
@laszlo-karpati

laszlo-karpati May 11, 2017

Contributor

@DavertMik Sure,
I've just pushed the backward compatibility.

Contributor

laszlo-karpati commented May 11, 2017

@DavertMik Sure,
I've just pushed the backward compatibility.

@DavertMik DavertMik merged commit 0b13d5f into Codeception:2.2 May 11, 2017

4 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
semaphoreci The build passed on Semaphore.
Details
wercker/build Wercker pipeline passed
Details
@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik May 11, 2017

Member

Thanks

Member

DavertMik commented May 11, 2017

Thanks

@polki-bil

This comment has been minimized.

Show comment
Hide comment
@polki-bil

polki-bil Jun 13, 2017

Hello, we are still having problem. Symfony generates proxy class for EntityManager, so Doctrine2 module can't find repositories nor repositoriyFactory.
class:
DoctrineORMEntityManager_00000000136fffc9000 ....
and has only properties (shortened):

    object(ReflectionProperty)[2677]
    public 'name' => string 'valueHolder593fb92bd0e38185253777' (length=33)
    object(ReflectionProperty)[3536]
    public 'name' => string 'initializer593fb92bd0e4f480946614' (length=33)
    object(ReflectionProperty)[3539]
    public 'name' => string 'publicProperties593fb92bd0dee937024105' (length=38)

We are using Symofny 3.3 and Doctrine 4.5
We tried various Symfony configs to prevent from generating this, but with no success.
With this code added it works but it is not a good solution I guess:
$ReflectedEm->getParentClass()->hasProperty('repositoriyFactory');

Thanks for any help

polki-bil commented Jun 13, 2017

Hello, we are still having problem. Symfony generates proxy class for EntityManager, so Doctrine2 module can't find repositories nor repositoriyFactory.
class:
DoctrineORMEntityManager_00000000136fffc9000 ....
and has only properties (shortened):

    object(ReflectionProperty)[2677]
    public 'name' => string 'valueHolder593fb92bd0e38185253777' (length=33)
    object(ReflectionProperty)[3536]
    public 'name' => string 'initializer593fb92bd0e4f480946614' (length=33)
    object(ReflectionProperty)[3539]
    public 'name' => string 'publicProperties593fb92bd0dee937024105' (length=38)

We are using Symofny 3.3 and Doctrine 4.5
We tried various Symfony configs to prevent from generating this, but with no success.
With this code added it works but it is not a good solution I guess:
$ReflectedEm->getParentClass()->hasProperty('repositoriyFactory');

Thanks for any help

chris1312 added a commit to chris1312/Codeception that referenced this pull request Jun 16, 2017

fix haveFakeRepository in the doctrine module (#4212)
* fix haveFakeRepository in the doctrine module

* add support for doctrine versions before 2.4.0
@laszlo-karpati

This comment has been minimized.

Show comment
Hide comment
@laszlo-karpati

laszlo-karpati Jun 16, 2017

Contributor

Hi @polki-bil!

I think you've mistyped your Doctrine's version, and you are using v2.5.

As I see Docrine was adding the entityManager's spl_object_hash to the repositoryList key's name in the DefaultRepositoryFactory since version 2.5.

They added it with this commit, released in version 2.5:
doctrine/doctrine2@a984753

I'm using Doctrine v2.4 right now, but if I'll have time for it in the next days, I will try to figure out something for it.

Could you try it with the v2.4's DefaultRepositoryFactory class?

Contributor

laszlo-karpati commented Jun 16, 2017

Hi @polki-bil!

I think you've mistyped your Doctrine's version, and you are using v2.5.

As I see Docrine was adding the entityManager's spl_object_hash to the repositoryList key's name in the DefaultRepositoryFactory since version 2.5.

They added it with this commit, released in version 2.5:
doctrine/doctrine2@a984753

I'm using Doctrine v2.4 right now, but if I'll have time for it in the next days, I will try to figure out something for it.

Could you try it with the v2.4's DefaultRepositoryFactory class?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment