Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: sonata-project/SonataDoctrineMongoDBAdminBundle
base: 2aacb72135
...
head fork: sonata-project/SonataDoctrineMongoDBAdminBundle
compare: 86b85118db
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
Commits on May 08, 2012
Rommel M. Zamora Temporary fix to make it work with SonataAdminBundle 031b052
Rommel M. Zamora fix for compatibility for ProxyQueryInterface 926606a
@dunglas dunglas Merge pull request #16 from rmzamora/master
Class incompatibility fix for SonataAdminBundle 2.0
86b8511
Showing with 49 additions and 2 deletions.
  1. +28 −0 Admin/FieldDescription.php
  2. +21 −2 Datagrid/ProxyQuery.php
View
28 Admin/FieldDescription.php
@@ -89,4 +89,32 @@ public function isIdentifier()
return isset($this->fieldMapping['id']) ? $this->fieldMapping['id'] : false;
}
+ /**
+ * return the value linked to the description
+ *
+ * @param $object
+ * @return bool|mixed
+ */
+ public function getValue($object)
+ {
+ if($this->parentAssociationMappings) {
+ foreach ($this->parentAssociationMappings as $parentAssociationMapping) {
+ $object = $this->getFieldValue($object, $parentAssociationMapping['fieldName']);
+ }
+ }
+
+ return $this->getFieldValue($object, $this->fieldName);
+ }
+
+ public function setParentAssociationMappings(array $parentAssociationMappings)
+ {
+ foreach ($parentAssociationMappings as $parentAssociationMapping) {
+ if (!is_array($parentAssociationMapping)) {
+ throw new \RuntimeException('An association mapping must be an array');
+ }
+ }
+
+ $this->parentAssociationMappings = $parentAssociationMappings;
+ }
+
}
View
23 Datagrid/ProxyQuery.php
@@ -59,9 +59,10 @@ public function __call($name, $args)
return call_user_func_array(array($this->queryBuilder, $name), $args);
}
- public function setSortBy($sortBy)
+ public function setSortBy($parentAssociationMappings, $fieldMapping)
{
- $this->sortBy = $sortBy;
+ $alias = $this->entityJoin($parentAssociationMappings);
+ $this->sortBy = $alias . '.' . $fieldMapping['fieldName'];
}
public function getSortBy()
@@ -118,4 +119,22 @@ function getMaxResults()
return $this->maxResults;
}
+ /**
+ * @return mixed
+ */
+ function getUniqueParameterId()
+ {
+ // TODO: Implement getUniqueParameterId() method.
+ }
+
+ /**
+ * @param array $associationMappings
+ *
+ * @return mixed
+ */
+ function entityJoin(array $associationMappings)
+ {
+ // TODO: Implement entityJoin() method.
+ }
+
}

No commit comments for this range

Something went wrong with that request. Please try again.