Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.0-ALPHA4
-
Component/s: ORM
-
Security Level: All
-
Labels:None
-
Environment:PHP 5.3.1 Win32 (XP SP3), pdo_mysql, AnnotationDriver used
Description
I have a class hierarchy:
resource (id, type, name)
| ---> module () |
| ---> controller (ref to module) ---> action (ref to controller) It is mapped with inheritamce type = "JOINED" During the class ClassMetadata deserialization exception belows is thrown: |
ReflectionException: Property id does not exist in E:\Projects\portal\library\Doctrine\ORM\Mapping\ClassMetadata.php on line 362
Call Stack:
0.0003 334120 1.
() E:\Projects\DoctrineTest\index.php:0
0.0291 2124544 2. Doctrine\ORM\EntityManager->find() E:\Projects\DoctrineTest\index.php:24
0.0291 2124544 3. Doctrine\ORM\EntityManager->getRepository() E:\Projects\portal\library\Doctrine\ORM\EntityManager.php:308
0.0291 2124544 4. Doctrine\ORM\EntityManager->getClassMetadata() E:\Projects\portal\library\Doctrine\ORM\EntityManager.php:489
0.0291 2124544 5. Doctrine\ORM\Mapping\ClassMetadataFactory->getMetadataFor() E:\Projects\portal\library\Doctrine\ORM\EntityManager.php:220
0.0291 2124608 6. Doctrine\Common\Cache\AbstractCache->fetch() E:\Projects\portal\library\Doctrine\ORM\Mapping\ClassMetadataFactory.php:133
0.0292 2124608 7. CacheDriver->_doFetch() E:\Projects\portal\library\Doctrine\Common\Cache\AbstractCache.php:89
0.0292 2124608 8. CacheDriver->init() E:\Projects\DoctrineTest\CacheDriver.php:61
0.0293 2127872 9. unserialize() E:\Projects\DoctrineTest\CacheDriver.php:49
0.0336 2609432 10. Doctrine\ORM\Mapping\ClassMetadata->__wakeup() E:\Projects\portal\library\Doctrine\ORM\Mapping\ClassMetadata.php:0
0.0340 2633128 11. ReflectionClass->getProperty() E:\Projects\portal\library\Doctrine\ORM\Mapping\ClassMetadata.php:362
I have attached file with sample code.. I hope it will be helpful
I have found workaround:
1. add to returned by the __sleep method array 'reflClass' and 'reflFields' fields.
2. write code for recreating the ReflectionClass and ReflectionPropery objects (I think this is a PHP error, Reflection* classes is restored in wrong state). It looks like code below:
$this->reflClass = new \ReflectionClass($this->reflClass->name); foreach ($this->reflFields as $field => $reflField) { $this->reflFields[$field] = new \ReflectionProperty($reflField->class, $reflField->name); $this->reflFields[$field]->setAccessible(true); }