浏览代码

Fixed code value in sonata_type_model_autocomplete_widget so it works with embedded admins
Fixed $property name in HelperController::retrieveAutocompleteItemsAction() (was $prop)
- minor change to exception message so apostrophe is not needed
- removed unused Controller reference from top of HelperController

caponica 10 年之前
父节点
当前提交
271121a747
共有 2 个文件被更改,包括 3 次插入4 次删除
  1. 2 3
      Controller/HelperController.php
  2. 1 1
      Resources/views/Form/form_admin_fields.html.twig

+ 2 - 3
Controller/HelperController.php

@@ -11,7 +11,6 @@
 
 namespace Sonata\AdminBundle\Controller;
 
-use Symfony\Bundle\FrameworkBundle\Controller\Controller;
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 use Symfony\Component\HttpFoundation\Response;
 use Symfony\Component\HttpFoundation\JsonResponse;
@@ -364,7 +363,7 @@ class HelperController
                 }
             } else {
                 if (!$datagrid->hasFilter($property)) {
-                    throw new \RuntimeException(sprintf('To retrieve autocomplete items, you should add filter "%s" to "%s" in configureDatagridFilters() method.', $prop, get_class($targetAdmin)));
+                    throw new \RuntimeException(sprintf('To retrieve autocomplete items, you should add filter "%s" to "%s" in configureDatagridFilters() method.', $property, get_class($targetAdmin)));
                 }
 
                 $datagrid->setValue($property, null, $searchText);
@@ -383,7 +382,7 @@ class HelperController
         foreach ($results as $entity) {
             if ($toStringCallback !== null) {
                 if (!is_callable($toStringCallback)) {
-                    throw new \RuntimeException('Option "to_string_callback" doesn`t contain callable function.');
+                    throw new \RuntimeException('Option "to_string_callback" does not contain callable function.');
                 }
 
                 $label = call_user_func($toStringCallback, $entity, $property);

+ 1 - 1
Resources/views/Form/form_admin_fields.html.twig

@@ -290,7 +290,7 @@ file that was distributed with this source code.
 
                                 // admin
                                 'uniqid': "{{ sonata_admin.admin.root.uniqid }}",
-                                'code':   "{{ sonata_admin.admin.root.code }}",
+                                'code':   "{{ sonata_admin.admin.code }}",
                                 'field':  "{{ name }}"
 
                                 // other parameters