소스 검색

[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);
+    }
 }