Created
July 6, 2011 08:51
-
-
Save bartrail/1066858 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
<?php | |
/** | |
* {@inheritdoc} | |
*/ | |
public function loadMetadataForClass($className, ClassMetadataInfo $class) | |
{ | |
$reflClass = $class->getReflectionClass(); | |
$documentAnnots = array(); | |
foreach ($this->reader->getClassAnnotations($reflClass) as $annot) { | |
foreach (self::$documentAnnotationClasses as $i => $annotClass) { | |
if ($annot instanceof $annotClass) { | |
$documentAnnots[$i] = $annot; | |
goto next_annotation; | |
} | |
} | |
// non-document class annotations | |
if ($annot instanceof ODM\AbstractIndex) { | |
$this->addIndex($class, $annot); | |
} | |
if ($annot instanceof ODM\Indexes) { | |
foreach (is_array($annot->value) ? $annot->value : array($annot->value) as $index) { | |
$this->addIndex($class, $index); | |
} | |
} elseif ($annot instanceof ODM\InheritanceType) { | |
$class->setInheritanceType(constant('Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata::INHERITANCE_TYPE_'.$annot->value)); | |
} elseif ($annot instanceof ODM\DiscriminatorField) { | |
$class->setDiscriminatorField(array('fieldName' => $annot->fieldName)); | |
} elseif ($annot instanceof ODM\DiscriminatorMap) { | |
$class->setDiscriminatorMap($annot->value); | |
} elseif ($annot instanceof ODM\DiscriminatorValue) { | |
$class->setDiscriminatorValue($annot->value); | |
} elseif ($annot instanceof ODM\ChangeTrackingPolicy) { | |
$class->setChangeTrackingPolicy(constant('Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata::CHANGETRACKING_'.$annot->value)); | |
} | |
next_annotation: | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment