public function submit($data)
    {
        // track which forms we will keep and which values
        $resultingForms = [];
        $resultingValue = [];

        foreach ($this->forms as $k => $form) {
            if (isset($data[$k])) {
                $form->submit($data[$k]);
                // keep the form and its value
                $resultingForms[] = $form;
                $resultingValue[] = $form->getValue();
            }
        }

        $this->forms = $resultingForms;
        $this->value = $resultingValue;

        // did we receive additional sub forms (created from the blueprint)?
        if (isset($data[self::ADDITIONAL]) && is_array($data[self::ADDITIONAL])) {

            foreach ($data[self::ADDITIONAL] as $v) {
                // we need the key for the additional form
                $key = count($this->forms);
                // we create the additional form and set the key for the id
                $additionalForm = $this->createBlueprintForm();
                $additionalForm->setId($key);
                $additionalForm->submit($v);

                // also remember that form and changes the parent
                $this->forms[$key] = $additionalForm;
                // also we need to update the value stored on the collection field
                $this->value[$key] = $additionalForm->getValue();
            }
        }

        return $this;
    }
public function submit($data)
    {
        // track which forms we will keep and which values
        $resultingForms = [];
        $resultingValue = [];

        foreach ($this->forms as $k => $form) {
            if (isset($data[$k])) {
                $form->submit($data[$k]);
                // keep the form and its value
                $resultingForms[] = $form;
                $resultingValue[] = $form->getValue();
            }
        }

        $this->forms = $resultingForms;
        $this->value = $resultingValue;

        // did we receive additional sub forms (created from the blueprint)?
        if (isset($data[self::ADDITIONAL]) && is_array($data[self::ADDITIONAL])) {

            foreach ($data[self::ADDITIONAL] as $v) {
                // we need the key for the additional form
                $key = count($this->forms);
                // we create the additional form and set the key for the id
                $additionalForm = $this->createBlueprintForm();
                $additionalForm->setId($key);
                $additionalForm->submit($v);

                // also remember that form and changes the parent
                $this->forms[$key] = $additionalForm;
                // also we need to update the value stored on the collection field
                $this->value[$key] = $additionalForm->getValue();
            }
        }

        return $this;
    }
@param mixed[][] $data

@return $this