]>
Commit | Line | Data |
---|---|---|
4f5b44bd NL |
1 | <?php |
2 | ||
3 | /* | |
4 | * This file is part of the Symfony package. | |
5 | * | |
6 | * (c) Fabien Potencier <fabien@symfony.com> | |
7 | * | |
8 | * For the full copyright and license information, please view the LICENSE | |
9 | * file that was distributed with this source code. | |
10 | */ | |
11 | ||
12 | namespace Symfony\Component\Form\Util; | |
13 | ||
14 | /** | |
15 | * Iterator that returns only forms from a form tree that do not inherit their | |
16 | * parent data. | |
17 | * | |
18 | * If the iterator encounters a form that inherits its parent data, it enters | |
19 | * the form and traverses its children as well. | |
20 | * | |
21 | * @author Bernhard Schussek <bschussek@gmail.com> | |
22 | * | |
23 | * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use | |
24 | * {@link InheritDataAwareIterator} instead. | |
25 | */ | |
26 | class VirtualFormAwareIterator extends \ArrayIterator implements \RecursiveIterator | |
27 | { | |
28 | /** | |
29 | * Creates a new iterator. | |
30 | * | |
31 | * @param \Symfony\Component\Form\FormInterface[] $forms An array | |
32 | */ | |
33 | public function __construct(array $forms) | |
34 | { | |
35 | // Uncomment this as soon as the deprecation note should be shown | |
36 | // trigger_error('VirtualFormAwareIterator is deprecated since version 2.3 and will be removed in 3.0. Use InheritDataAwareIterator instead.', E_USER_DEPRECATED); | |
37 | ||
38 | parent::__construct($forms); | |
39 | } | |
40 | ||
41 | public function getChildren() | |
42 | { | |
43 | return new static($this->current()->all()); | |
44 | } | |
45 | ||
46 | public function hasChildren() | |
47 | { | |
48 | return $this->current()->getConfig()->getInheritData(); | |
49 | } | |
50 | } |