Преглед изворни кода

adjust admin to use the url safe id

David Buchmann пре 12 година
родитељ
комит
b1ec7ff40b
2 измењених фајлова са 14 додато и 1 уклоњено
  1. 9 1
      Admin/Admin.php
  2. 5 0
      Admin/AdminInterface.php

+ 9 - 1
Admin/Admin.php

@@ -1069,7 +1069,7 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
      */
     public function generateObjectUrl($name, $object, array $parameters = array(), $absolute = false)
     {
-        $parameters['id'] = $this->getNormalizedIdentifier($object);
+        $parameters['id'] = $this->getUrlsafeIdentifier($object);
 
         return $this->generateUrl($name, $parameters, $absolute);
     }
@@ -2336,6 +2336,14 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
         return $this->securityHandler->isGranted($this, $name, $object ?: $this);
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    public function getUrlsafeIdentifier($entity)
+    {
+        return $this->getModelManager()->getUrlsafeIdentifier($entity);
+    }
+
     /**
      * {@inheritdoc}
      */

+ 5 - 0
Admin/AdminInterface.php

@@ -241,6 +241,11 @@ interface AdminInterface
      */
     function isGranted($name, $object = null);
 
+    /**
+     * @param mixed $entity
+     */
+    function getUrlsafeIdentifier($entity);
+
     /**
      * @param mixed $entity
      */