Esempio n. 1
0
 /**
  * @param ClassMetadata $class
  * @return array
  */
 private function prepareIndexes(ClassMetadata $class)
 {
     $persister = $this->dm->getUnitOfWork()->getDocumentPersister($class->name);
     $indexes = $class->getIndexes();
     $newIndexes = array();
     foreach ($indexes as $index) {
         $newIndex = array('keys' => array(), 'options' => $index['options']);
         foreach ($index['keys'] as $key => $value) {
             $key = $persister->prepareFieldName($key);
             if ($class->hasField($key)) {
                 $mapping = $class->getFieldMapping($key);
                 $newIndex['keys'][$mapping['name']] = $value;
             } else {
                 $newIndex['keys'][$key] = $value;
             }
         }
         $newIndexes[] = $newIndex;
     }
     return $newIndexes;
 }
Esempio n. 2
0
 private function prepareIndexes(ClassMetadata $class)
 {
     $indexes = $class->getIndexes();
     $newIndexes = array();
     foreach ($indexes as $index) {
         $newIndex = array('keys' => array(), 'options' => $index['options']);
         foreach ($index['keys'] as $key => $value) {
             $mapping = $class->getFieldMapping($key);
             $newIndex['keys'][$mapping['name']] = $value;
         }
         $newIndexes[] = $newIndex;
     }
     return $newIndexes;
 }