DDC-907: Allowing overriding of Mapping\ClassMetaData #1125

Closed
opened 2026-01-22 13:03:04 +01:00 by admin · 5 comments
Owner

Originally created by @doctrinebot on GitHub (Dec 1, 2010).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user juzna:

When overriding class ClassMetadata for making customized mapping, its now not possible to use own reflection implementation, because ClassMetadata and ClassMetadataInfo implementation creates reflection classes directly.

I'm proposing a patch, which will allow for for a class overloading ClassMetadata to create it's own reflection.

The code needed to do so would be:
class MySuperClassMetadata extends \Doctrine\ORM\Mapping\ClassMetadata {
... my code

public function getReflectionClass() {
if(!$this->reflClass) {
$this->reflClass = new MySuperReflectionClass($this->name);
}
return $this->reflClass;
}

public function _getNewReflectionProperty($class, $property) {
return new MySuperReflectionProperty($class, $property);
}
}

Which also much simplifies code from this article: http://www.doctrine-project.org/blog/your-own-orm-doctrine2

(Hope it's OK, I'm not much familiar with contributing to open source projects yet)

Originally created by @doctrinebot on GitHub (Dec 1, 2010). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user juzna: When overriding class ClassMetadata for making customized mapping, its now not possible to use own reflection implementation, because ClassMetadata and ClassMetadataInfo implementation creates reflection classes directly. I'm proposing a patch, which will allow for for a class overloading ClassMetadata to create it's own reflection. The code needed to do so would be: class MySuperClassMetadata extends \Doctrine\ORM\Mapping\ClassMetadata { ... my code public function getReflectionClass() { if(!$this->reflClass) { $this->reflClass = new MySuperReflectionClass($this->name); } return $this->reflClass; } public function _getNewReflectionProperty($class, $property) { return new MySuperReflectionProperty($class, $property); } } Which also much simplifies code from this article: http://www.doctrine-project.org/blog/your-own-orm-doctrine2 (Hope it's OK, I'm not much familiar with contributing to open source projects yet)
admin added the Improvement label 2026-01-22 13:03:04 +01:00
admin closed this issue 2026-01-22 13:03:06 +01:00
Author
Owner

@doctrinebot commented on GitHub (Dec 2, 2010):

Comment created by @beberlei:

This was implemented with DDC-897.

@doctrinebot commented on GitHub (Dec 2, 2010): Comment created by @beberlei: This was implemented with [DDC-897](http://www.doctrine-project.org/jira/browse/DDC-897).
Author
Owner

@doctrinebot commented on GitHub (Dec 2, 2010):

Comment created by juzna:

DDC-897 allowed overriding, but does not support simple overriding of reflection. My proposed patches considers only reflection overloading.
(Which is needed for ActiveEntity implementation as mentioned in that article).

@doctrinebot commented on GitHub (Dec 2, 2010): Comment created by juzna: [DDC-897](http://www.doctrine-project.org/jira/browse/DDC-897) allowed overriding, but does not support simple overriding of reflection. My proposed patches considers only reflection overloading. (Which is needed for ActiveEntity implementation as mentioned in that article).
Author
Owner

@doctrinebot commented on GitHub (Apr 20, 2012):

Comment created by juzna:

not relevant anymore

@doctrinebot commented on GitHub (Apr 20, 2012): Comment created by juzna: not relevant anymore
Author
Owner

@doctrinebot commented on GitHub (Apr 20, 2012):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Apr 20, 2012): Issue was closed with resolution "Invalid"
Author
Owner

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

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

@doctrinebot commented on GitHub (Dec 13, 2015): Imported 1 attachments from Jira into https://gist.github.com/4e41ea67cae3fcf3a2a5 - [10881_0001-Needed-to-allowing-overriding-of-ClassMetaData-with-.patch](https://gist.github.com/4e41ea67cae3fcf3a2a5#file-10881_0001-Needed-to-allowing-overriding-of-ClassMetaData-with--patch)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1125