Skip to content

Conversation

melkamar
Copy link

Fixes #420.

My assumption here is that using the native ReflectionProperty for static properties won't cause the lazy proxy classes to get instantiated. The tests seem to confirm that.

Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

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

I don't think this was a use case that had been considered, given that this class is designed to access the properties of managed objects. In fact, I don't think the latest versions of Doctrine ORM use it. What is your use case?

public function setValue($object, $value = null)
{
if (! ($object instanceof Proxy && ! $object->__isInitialized())) {
if ((! ($object instanceof Proxy && ! $object->__isInitialized())) || $this->isStatic()) {
Copy link
Member

Choose a reason for hiding this comment

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

The extra parenthesis are not necessary. You can switch the operands to remove any ambiguity.

Suggested change
if ((! ($object instanceof Proxy && ! $object->__isInitialized())) || $this->isStatic()) {
if ($this->isStatic() || ! ($object instanceof Proxy && ! $object->__isInitialized())) {

@GromNaN
Copy link
Member

GromNaN commented Sep 29, 2025

I've seen your comment #420 (comment), I think PR can be closed? Could you open an issue on doctrine/mongodb-odm ?

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.

2 participants