Prechádzať zdrojové kódy

Deprecate ModelChoiceList in favor of ModelChoiceLoader.

Jules Lamur 8 rokov pred
rodič
commit
c53911d2c0
2 zmenil súbory, kde vykonal 18 pridanie a 0 odobranie
  1. 10 0
      Form/ChoiceList/ModelChoiceList.php
  2. 8 0
      UPGRADE-3.x.md

+ 10 - 0
Form/ChoiceList/ModelChoiceList.php

@@ -20,7 +20,17 @@ use Symfony\Component\PropertyAccess\PropertyAccess;
 use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
 use Symfony\Component\PropertyAccess\PropertyPath;
 
+@trigger_error(
+    'The '.__CLASS__.' class is deprecated since 3.x and will be removed in 4.0.'
+    .' Use '.__NAMESPACE__.'\ModelChoiceLoader instead.',
+    E_USER_DEPRECATED
+);
+
 /**
+ * NEXT_MAJOR: Remove this class.
+ *
+ * @deprecated Since 3.x, to be removed in 4.0. Use Sonata\AdminBundle\ModelChoiceLoader instead
+ *
  * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
  */
 class ModelChoiceList extends SimpleChoiceList

+ 8 - 0
UPGRADE-3.x.md

@@ -1,6 +1,14 @@
 UPGRADE 3.x
 ===========
 
+## Deprecated ModelChoiceList class in favor of ModelChoiceLoader
+
+The `ModelChoiceList` class is no longer supported. Please use the `ModelChoiceLoader` class instead.
+
+The `ModelChoiceList` is usually used on the [`choice_list`](http://symfony.com/doc/2.8/reference/forms/types/choice.html#choice-list)
+option of a `FormBuilder`. The `ModelChoiceLoader` class must be replaced on the
+[`choice_loader`](http://symfony.com/doc/3.3/reference/forms/types/choice.html#choice-loader) option.
+
 UPGRADE FROM 3.13 to 3.14
 =========================