|
@@ -314,6 +314,14 @@ abstract class BaseFieldDescription implements FieldDescriptionInterface
|
|
|
return $this->fieldMapping;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * {@inheritdoc}
|
|
|
+ */
|
|
|
+ public function getParentAssociationMappings()
|
|
|
+ {
|
|
|
+ return $this->parentAssociationMappings;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* set the association admin instance (only used if the field is linked to an Admin)
|
|
|
*
|
|
@@ -343,6 +351,31 @@ abstract class BaseFieldDescription implements FieldDescriptionInterface
|
|
|
return $this->associationAdmin !== null;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * {@inheritdoc}
|
|
|
+ */
|
|
|
+ public function getFieldValue($object, $fieldName)
|
|
|
+ {
|
|
|
+ $camelizedFieldName = self::camelize($fieldName);
|
|
|
+
|
|
|
+ $getters = array();
|
|
|
+ // prefer method name given in the code option
|
|
|
+ if ($this->getOption('code')) {
|
|
|
+ $getters[] = $this->getOption('code');
|
|
|
+ }
|
|
|
+ $getters[] = 'get'.$camelizedFieldName;
|
|
|
+ $getters[] = 'is'.$camelizedFieldName;
|
|
|
+
|
|
|
+
|
|
|
+ foreach ($getters as $getter) {
|
|
|
+ if (method_exists($object, $getter)) {
|
|
|
+ return call_user_func(array($object, $getter));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ throw new NoValueException(sprintf('Unable to retrieve the value of `%s`', $this->getName()));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* return the value linked to the description
|
|
|
*
|
|
@@ -482,4 +515,28 @@ abstract class BaseFieldDescription implements FieldDescriptionInterface
|
|
|
{
|
|
|
return $this->getOption('label');
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * {@inheritdoc}
|
|
|
+ */
|
|
|
+ public function isSortable()
|
|
|
+ {
|
|
|
+ return $this->getOption('sortable', false);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * {@inheritdoc}
|
|
|
+ */
|
|
|
+ public function getSortFieldMapping()
|
|
|
+ {
|
|
|
+ return $this->getOption('sort_field_mapping');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * {@inheritdoc}
|
|
|
+ */
|
|
|
+ public function getSortParentAssociationMapping()
|
|
|
+ {
|
|
|
+ return $this->getOption('sort_parent_association_mappings');
|
|
|
+ }
|
|
|
}
|