[DDC-388] Private properties in @MappedSupperclass don't work Created: 03/Mar/10  Updated: 14/Apr/10  Resolved: 14/Apr/10

Status: Closed
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: None
Fix Version/s: 2.0-BETA1
Security Level: All

Type: Bug Priority: Critical
Reporter: Jaka Jancar Assignee: Roman S. Borschel
Resolution: Fixed Votes: 2
Labels: None

PHP 5.3.1

Issue Links:
is duplicated by DDC-456 Wrong implementation of loading metad... Closed


All of my entites extend an abstract class Model to inherit the 'id' property and some other functionality. It has the @MappedSuperclass annotation.

If the id property is declared private to the Model class, I'll get the following exception when using entites extending it:

[03-Mar-2010 11:36:29] exception 'ReflectionException' with message 'Property id does not exist' in library/Doctrine/ORM/Mapping/ClassMetadata.php:370
Stack trace:
#0 library/Doctrine/ORM/Mapping/ClassMetadata.php(370): ReflectionClass->getProperty('id')
#1 [internal function]: Doctrine\ORM\Mapping\ClassMetadata->__wakeup()

I haven't looked at Doctrine code, but perhaps you should be looking for the property on the class which actually has the @Column annotation?

Comment by Roman S. Borschel [ 03/Mar/10 ]

Yes, I think the 'inherited' key is simply not set for fields that are inherited from mapped superclasses. This needs to be fixed.

Comment by Roman S. Borschel [ 14/Apr/10 ]

Fixed in http://github.com/doctrine/doctrine2/commit/d4232d906e433b1fe4dd8aa85aa7a4aca3a2cf4c .
Make sure to clear the metadata cache if necessary.

Generated at Mon Nov 30 14:09:02 EST 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.