Преглед на файлове

[Form] Made FormView implement Countable

Tobias Naumann преди 14 години
родител
ревизия
f6ce451e2c
променени са 1 файла, в които са добавени 10 реда и са изтрити 1 реда
  1. 10 1
      src/Symfony/Component/Form/FormView.php

+ 10 - 1
src/Symfony/Component/Form/FormView.php

@@ -14,7 +14,7 @@ namespace Symfony\Component\Form;
 use Symfony\Component\Form\FormInterface;
 use Symfony\Component\Form\Util\ChoiceUtil;
 
-class FormView implements \ArrayAccess, \IteratorAggregate
+class FormView implements \ArrayAccess, \IteratorAggregate, \Countable
 {
     private $vars = array(
         'value' => null,
@@ -179,4 +179,13 @@ class FormView implements \ArrayAccess, \IteratorAggregate
 
         return $choice === $this->vars['value'];
     }
+
+    /**
+     * @see Countable
+     * @return integer
+     */
+    public function count()
+    {
+        return count($this->children);
+    }
 }