Beispiel #1
0
 /**
  * @return string
  */
 public function getSearchDn()
 {
     return $this->class->getSearchDn();
 }
 /**
  * Return the class metadata instance
  * 
  * @param string $entityName
  * 
  * @return ClassMetaDataCollection
  */
 public function getClassMetadata($entityName)
 {
     $r = new ReflectionClass($entityName);
     $instanceMetadataCollection = new ClassMetaDataCollection();
     $instanceMetadataCollection->name = $entityName;
     $classAnnotations = $this->reader->getClassAnnotations($r);
     foreach ($classAnnotations as $classAnnotation) {
         if ($classAnnotation instanceof RepositoryAttribute) {
             $instanceMetadataCollection->setRepository($classAnnotation->getValue());
         }
         if ($classAnnotation instanceof ObjectClass) {
             $instanceMetadataCollection->setObjectClass($classAnnotation->getValue());
         }
         if ($classAnnotation instanceof SearchDn) {
             $instanceMetadataCollection->setSearchDn($classAnnotation->getValue());
         }
         if ($classAnnotation instanceof Dn) {
             $instanceMetadataCollection->setDn($classAnnotation->getValue());
         }
     }
     foreach ($r->getProperties() as $publicAttr) {
         $annotations = $this->reader->getPropertyAnnotations($publicAttr);
         foreach ($annotations as $annotation) {
             if ($annotation instanceof Attribute) {
                 $varname = $publicAttr->getName();
                 $attribute = $annotation->getName();
                 $instanceMetadataCollection->addMeta($varname, $attribute);
             }
             if ($annotation instanceof DnLinkArray) {
                 $varname = $publicAttr->getName();
                 $instanceMetadataCollection->addArrayOfLink($varname, $annotation->getValue());
             }
             if ($annotation instanceof Sequence) {
                 $varname = $publicAttr->getName();
                 $instanceMetadataCollection->addSequence($varname, $annotation->getValue());
             }
             if ($annotation instanceof DnPregMatch) {
                 $varname = $publicAttr->getName();
                 $instanceMetadataCollection->addRegex($varname, $annotation->getValue());
             }
             if ($annotation instanceof ParentDn) {
                 $varname = $publicAttr->getName();
                 $instanceMetadataCollection->addParentLink($varname, $annotation->getValue());
             }
             if ($annotation instanceof ArrayField) {
                 $instanceMetadataCollection->addArrayField($varname);
             }
             if ($annotation instanceof Must) {
                 $instanceMetadataCollection->addMust($varname);
             }
             if ($annotation instanceof Operational) {
                 $instanceMetadataCollection->addOperational($varname);
             }
         }
     }
     return $instanceMetadataCollection;
 }