Created
July 24, 2013 14:07
-
-
Save vaurat/6070898 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i have below : | |
my/Bundle/Document/Parent.php | |
my/Bundle/Document/Childs/Son.php | |
my/Bundle/Document/Childs/Daughter.php | |
and when i execute fixtures with persist/flush of a Son, i get : | |
[Symfony\Component\Debug\Exception\ContextErrorException] | |
Warning: class_parents(): Class my\Bundle\Document\Childs\Parent | |
does not exist and could not be loaded in /var/www/cogitosum/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php line 40 | |
The Son think his Parent is close to him, but it's wrong : he's upstairs !!! | |
What does i have to do to fix that ? | |
my\Bundle\Document\Parent.php : | |
==================================================== | |
namespace cogito\GCBundle\Document; | |
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; | |
/** | |
* @package my\Bundle\Document | |
* @ODM\Document (collection="Individual") | |
* @ODM\InheritanceType("SINGLE_COLLECTION") | |
* @ODM\DiscriminatorField(fieldName="discr") | |
* @ODM\DiscriminatorMap({ | |
* "Son" = "my\Bundle\Document\Childs\Son", | |
* "Daughter" = "my\Bundle\Document\Childs\Daughter" | |
* }) | |
*/ | |
abstract class Parent | |
{... | |
my\Bundle\Document\Childs\Son.php : | |
================================================== | |
namespace my\Bundle\Document\Childs; | |
use my\Bundle\Document\Parent as Parent; | |
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; | |
/** | |
* @package my\Bundle\Document\Childs | |
* @ODM\Document | |
*/ | |
class Son extends Parent | |
{... | |
my\Bundle\Document\Childs\Daughter.php: | |
===================================================== | |
namespace my\Bundle\Document\Childs; | |
use my\Bundle\Document\Parent as Parent; | |
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; | |
/** | |
* @package my\Bundle\Document\Childs | |
* @ODM\Document | |
*/ | |
class Daughter extends Parent | |
{... | |
this is my autoload.php: | |
=================================================== | |
<?php | |
use Doctrine\Common\Annotations\AnnotationRegistry; | |
use Composer\Autoload\ClassLoader; | |
use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver; | |
/** | |
* @var $loader ClassLoader | |
*/ | |
$loader = require __DIR__.'/../vendor/autoload.php'; | |
AnnotationRegistry::registerLoader(array($loader, 'loadClass')); | |
AnnotationDriver::registerAnnotationClasses(); | |
return $loader; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment