Permalink
Browse files

Added field mappings into class metadata

  • Loading branch information...
1 parent f41f359 commit 8cb5b60aa4c02502a6cabc9b6a8abc8e9ef1ddc0 @MrHash MrHash committed Apr 24, 2013
@@ -82,11 +82,6 @@ class ClassMetadata implements ClassMetadataInterface
*/
public $value = 1;
- /**
- * @var float
- */
- public $boost = 1.0;
-
/**
* @var string
*/
@@ -135,7 +130,6 @@ public function __sleep()
{
// This metadata is always serialized/cached.
return array(
- 'boost',
'className',
'fieldMappings',
'index',
@@ -232,11 +226,11 @@ public function hasField($fieldName)
* @param \ReflectionProperty $field
* @param array $mapping
*/
- /*public function addFieldMapping(\ReflectionProperty $field, $mapping = array())
+ public function addFieldMapping(\ReflectionProperty $field, $mapping = array())
{
$fieldName = $field->getName();
$this->fieldMappings[$fieldName] = $mapping;
- }*/
+ }
/**
* @param \ReflectionProperty $field
@@ -126,26 +126,18 @@ private function extractPropertiesAnnotations(array $reflProperties, ClassMetada
$documentsFieldAnnotations = array();
foreach ($reflProperties as $reflProperty) {
foreach ($this->reader->getPropertyAnnotations($reflProperty) as $annotation) {
- foreach (self::$documentFieldAnnotationClasses as $i => $fieldAnnotationClass) {
+ foreach (self::$documentFieldAnnotationClasses as $fieldAnnotationClass) {
if ($annotation instanceof $fieldAnnotationClass) {
- $documentsFieldAnnotations[$i] = $annotation;
+ $metadata->addFieldMapping($reflProperty, $annotation);
continue 2;
}
}
}
}
- foreach ($documentsFieldAnnotations as $documentsFieldAnnotation) {
- $reflFieldAnnotations = new \ReflectionClass($documentsFieldAnnotation);
- $metadata = $this->addValuesToMetadata($reflFieldAnnotations->getProperties(),
- $metadata,
- $documentsFieldAnnotation);
-
- }
-
return $metadata;
}
-
+
/**
* @param \ReflectionProperty[] $reflectedClassProperties
* @param ClassMetadata $metadata
@@ -164,9 +156,6 @@ private function addValuesToMetadata(array $reflectedClassProperties, ClassMetad
throw new DriverException\PropertyDoesNotExistsInMetadataException($reflectedProperty->getName());
} else {
$metadata->$propertyName = $class->$propertyName;
- /*I am not sure if that is needed
- * $metadata->addField($reflectedProperty);
- $metadata->addFieldMapping($reflectedProperty);*/
}
}

0 comments on commit 8cb5b60

Please sign in to comment.