-
-
Notifications
You must be signed in to change notification settings - Fork 586
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace JMS\Serializer\Tests\Fixtures; | ||
|
||
use Closure; | ||
use ProxyManager\Proxy\LazyLoadingInterface; | ||
|
||
class SimpleObjectLazyLoading extends SimpleObject implements LazyLoadingInterface | ||
{ | ||
public $__isInitialized__ = false; | ||
|
||
private $initializer; | ||
|
||
private $baz = 'baz'; | ||
|
||
public function __load() | ||
{ | ||
if (!$this->__isInitialized__) { | ||
$this->camelCase = 'proxy-boo'; | ||
$this->__isInitialized__ = true; | ||
} | ||
} | ||
|
||
public function __isInitialized() | ||
{ | ||
return $this->__isInitialized__; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function setProxyInitializer(?Closure $initializer = null) | ||
{ | ||
$this->initializer = $initializer; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getProxyInitializer(): ?Closure | ||
{ | ||
return $this->initializer; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function initializeProxy(): bool | ||
{ | ||
if (!$this->__isInitialized__) { | ||
$this->camelCase = 'proxy-boo'; | ||
$this->__isInitialized__ = true; | ||
|
||
return !$this->initializer || call_user_func($this->initializer); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function isProxyInitialized(): bool | ||
{ | ||
return $this->__isInitialized__; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
is
ORMProxy
still considered? does this work also withocramius/proxy-manager: 1.x
?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.
For
ORMProxy
I found that it implementsProxy
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 withLazyLoadingInterface
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?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.
I remember that, just if i'm not wrong wasn't so for all proxy-mamager versions
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.
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
andDoctrine\ORM\Proxy\Proxy
is instance ofDoctrine\Common\Proxy\Proxy
. Do you think it is still worth checking?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.
I think if the tests are green with #1139 (comment), then we are good to go