src/PeekAndPoke/Component/Formal/Field/FormCollectionField.php
public function setValue($value)
    {
        parent::setValue($value);

        if (! is_array($value) && ! $value instanceof \Traversable) {
            throw new \LogicException(
                'Cannot iterate field "' . $this->getId() . '" on value "' .
                (is_object($value) ? get_class($value) : gettype($value)) . '"'
            );
        }

        $this->forms = [];
        $creator     = $this->formCreator;

        foreach ($value as $k => $v) {
            $form = $creator($v, $k);

            if (! $form instanceof Form) {
                throw new \LogicException(
                    'The creator must return an instance of ' . Form::class
                );
            }

            $this->forms[$k] = $form;

            $form->setId($k);
            $form->setParent($this);
            $form->finalize();
        }

        return $this;
    }
public function setValue($value)
    {
        parent::setValue($value);

        if (! is_array($value) && ! $value instanceof \Traversable) {
            throw new \LogicException(
                'Cannot iterate field "' . $this->getId() . '" on value "' .
                (is_object($value) ? get_class($value) : gettype($value)) . '"'
            );
        }

        $this->forms = [];
        $creator     = $this->formCreator;

        foreach ($value as $k => $v) {
            $form = $creator($v, $k);

            if (! $form instanceof Form) {
                throw new \LogicException(
                    'The creator must return an instance of ' . Form::class
                );
            }

            $this->forms[$k] = $form;

            $form->setId($k);
            $form->setParent($this);
            $form->finalize();
        }

        return $this;
    }
@param array|\Iterator $value

@return $this