Created
July 6, 2011 08:48
-
-
Save bartrail/1066856 to your computer and use it in GitHub Desktop.
Revisions
-
bartrail revised this gist
Jul 6, 2011 . 1 changed file with 31 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ /** * {@inheritdoc} */ @@ -7,32 +8,42 @@ $documentAnnots = array(); foreach ($this->reader->getClassAnnotations($reflClass) as $annot) { $nextAnnotation = false; foreach (self::$documentAnnotationClasses as $i => $annotClass) { if ($annot instanceof $annotClass) { $documentAnnots[$i] = $annot; $nextAnnotation = true; break; // goto next_annotation; } } if($nextAnnotation == false) { // 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: } -
bartrail created this gist
Jul 6, 2011 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ /** * {@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: }