Matthias\SymfonyConsoleForm\Bridge\Interaction\CollectionInteractor::interactWith PHP Метод

interactWith() публичный Метод

public interactWith ( Symfony\Component\Form\FormInterface $form, Symfony\Component\Console\Helper\HelperSet $helperSet, Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output ) : array
$form Symfony\Component\Form\FormInterface
$helperSet Symfony\Component\Console\Helper\HelperSet
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
Результат array
    public function interactWith(FormInterface $form, HelperSet $helperSet, InputInterface $input, OutputInterface $output)
    {
        if (!$input->isInteractive()) {
            throw new CanNotInteractWithForm('This interactor only works with interactive input');
        }
        if (!FormUtil::isTypeInAncestry($form, CollectionType::class)) {
            throw new CanNotInteractWithForm('Expected a "collection" form');
        }
        if (!$form->getConfig()->getOption('allow_add')) {
            throw new FormNotReadyForInteraction('The "collection" form should have the option "allow_add"');
        }
        $this->printHeader($form, $output);
        $submittedData = [];
        $prototype = $form->getConfig()->getAttribute('prototype');
        while ($this->askIfContinueToAdd($helperSet, $input, $output)) {
            $submittedData[] = $this->formInteractor->interactWith($prototype, $helperSet, $input, $output);
        }
        return $submittedData;
    }