DDC-421: Add getFieldValue on ClassMetadata class #526

Closed
opened 2026-01-22 12:41:26 +01:00 by admin · 5 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 13, 2010).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user seldaek:

I would like the attached patch to be applied since it allows you to use the ClassMetadata in a much more obvious and consistent way.

i.e. it allows you to do :
{quote}
$this->_class->setFieldValue($entity, $field, 35);
$this->_class->getFieldValue($entity, $field);
{quote}

instead of the current:
{quote}
$this->_class->setFieldValue($entity, $field, 35);
$this->_class->getReflectionProperty($field)->getValue($entity);
{quote}

I am using the new style already in the NestedSet extension so it would be good if you could apply it fairly quickly if you agree.

Originally created by @doctrinebot on GitHub (Mar 13, 2010). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user seldaek: I would like the attached patch to be applied since it allows you to use the ClassMetadata in a much more obvious and consistent way. i.e. it allows you to do : {quote} $this->_class->setFieldValue($entity, $field, 35); $this->_class->getFieldValue($entity, $field); {quote} instead of the current: {quote} $this->_class->setFieldValue($entity, $field, 35); $this->_class->getReflectionProperty($field)->getValue($entity); {quote} I am using the new style already in the NestedSet extension so it would be good if you could apply it fairly quickly if you agree.
admin added the Improvement label 2026-01-22 12:41:26 +01:00
admin closed this issue 2026-01-22 12:41:26 +01:00
Author
Owner

@doctrinebot commented on GitHub (Mar 13, 2010):

Comment created by @beberlei:

please use $class->reflFields[$field]->getValue()

@doctrinebot commented on GitHub (Mar 13, 2010): Comment created by @beberlei: please use $class->reflFields[$field]->getValue()
Author
Owner

@doctrinebot commented on GitHub (Mar 13, 2010):

Issue was closed with resolution "Won't Fix"

@doctrinebot commented on GitHub (Mar 13, 2010): Issue was closed with resolution "Won't Fix"
Author
Owner

@doctrinebot commented on GitHub (Mar 13, 2010):

Comment created by romanb:

I think its OK to add this method, otherwise we would need to remove setFieldValue also for consistency. As an explanation for Jordi why Benjamin mentioned using reflFields is that we use this public property inside Doctrine for performance reasons (access + serialization) but for user code its probably mostly OK to use the more explicit variants.

This method will be incuded in my next commit where I remove a lot of unnecessary other boilerplate.

@doctrinebot commented on GitHub (Mar 13, 2010): Comment created by romanb: I think its OK to add this method, otherwise we would need to remove setFieldValue also for consistency. As an explanation for Jordi why Benjamin mentioned using reflFields is that we use this public property inside Doctrine for performance reasons (access + serialization) but for user code its probably mostly OK to use the more explicit variants. This method will be incuded in my next commit where I remove a lot of unnecessary other boilerplate.
Author
Owner

@doctrinebot commented on GitHub (Mar 14, 2010):

Comment created by seldaek:

Good, thank you, I was getting ready for war when I read Benjamin's response, but I'm glad someone got what I meant :) I'll keep using my hacked version until it's applied then.

@doctrinebot commented on GitHub (Mar 14, 2010): Comment created by seldaek: Good, thank you, I was getting ready for war when I read Benjamin's response, but I'm glad someone got what I meant :) I'll keep using my hacked version until it's applied then.
Author
Owner

@doctrinebot commented on GitHub (Dec 13, 2015):

Imported 1 attachments from Jira into https://gist.github.com/db7b74e7ee8d534dab50

@doctrinebot commented on GitHub (Dec 13, 2015): Imported 1 attachments from Jira into https://gist.github.com/db7b74e7ee8d534dab50 - [10455_metadata-getter.diff](https://gist.github.com/db7b74e7ee8d534dab50#file-10455_metadata-getter-diff)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#526