1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- /*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Sonata\BaseApplicationBundle\Form;
- use Symfony\Component\Form\FormInterface;
-
- /**
- * Iterator that traverses fields of a field group
- *
- * If the iterator encounters a virtual field group, it enters the field
- * group and traverses its children as well.
- *
- * @author Bernhard Schussek <bernhard.schussek@symfony-project.com>
- */
- class RecursiveFieldIterator extends \IteratorIterator implements \RecursiveIterator
- {
- protected $counter = 0;
-
- public function __construct(FormInterface $group)
- {
- parent::__construct($group);
- }
- public function getChildren()
- {
- return new self($this->current());
- }
- public function hasChildren()
- {
- return $this->current() instanceof FormInterface;
- }
- }
|