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

Support new doctrine ODM proxy objects #1139

Merged
merged 2 commits into from
Nov 14, 2019

Conversation

notrix
Copy link
Contributor

@notrix notrix commented Nov 12, 2019

Q A
Bug fix? no
New feature? yes
Doc updated no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT

As from version 2.0 doctrine/mongodb-odm uses ocramius/proxy-manager serializer needs to handle LazyLoadingInterface same as doctrine proxy objects.

@notrix notrix force-pushed the lazy-loading-proxy branch 2 times, most recently from 3b02ad8 to 92e2955 Compare November 12, 2019 08:11
@notrix notrix force-pushed the lazy-loading-proxy branch from 92e2955 to 415b2e6 Compare November 12, 2019 08:55
@@ -53,7 +53,7 @@ public function onPreSerialize(PreSerializeEvent $event): void
}

if (($this->skipVirtualTypeInit && $virtualType) ||
(!$object instanceof Proxy && !$object instanceof ORMProxy)
(!$object instanceof Proxy && !$object instanceof LazyLoadingInterface)
Copy link
Collaborator

@goetas goetas Nov 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is ORMProxy still considered? does this work also with ocramius/proxy-manager: 1.x ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For ORMProxy I found that it implements Proxy interface and think that it could be dropped at all because if !$object instanceof Proxy then it is obviously !$object instanceof ORMProxy. So I replaced it with LazyLoadingInterface

For ocramius/proxy-manager you are right. It should work with 1.x and even with 0.1.0 version (very first). Should I lower version in composer.json?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For ORMProxy I found that it implements Proxy interface and think that it could be dropped at all because if !$object instanceof Proxy then it is obviously !$object instanceof ORMProxy. So I replaced it with LazyLoadingInterface

I remember that, just if i'm not wrong wasn't so for all proxy-mamager versions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember that, just if i'm not wrong wasn't so for all proxy-mamager versions

Yes, proxy-manager has LaLoIn in all version, but I'm wondering how to reflect this in composer.json?
"ocramius/proxy-manager": "*" or "ocramius/proxy-manager": "^0.1|^1.0|^2.0"?

For ORMProxy, I have double checked with --prefer-lowest and Doctrine\ORM\Proxy\Proxy is instance of Doctrine\Common\Proxy\Proxy. Do you think it is still worth checking?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if the tests are green with #1139 (comment), then we are good to go

composer.json Outdated Show resolved Hide resolved
Co-Authored-By: Asmir Mustafic <[email protected]>
@goetas goetas merged commit 87c992d into schmittjoh:master Nov 14, 2019
@goetas
Copy link
Collaborator

goetas commented Nov 14, 2019

Thanks

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

Successfully merging this pull request may close these issues.

2 participants