PostSetDataEvent example

$this->viewData = $viewData;
        $this->defaultDataSet = true;
        $this->lockSetData = false;

        // Compound forms don't need to invoke this method if they don't have children         if (\count($this->children) > 0) {
            // Update child forms from the data (unless their config data is locked)             $this->config->getDataMapper()->mapDataToForms($viewDatanew \RecursiveIteratorIterator(new InheritDataAwareIterator($this->children)));
        }

        if ($dispatcher->hasListeners(FormEvents::POST_SET_DATA)) {
            $event = new PostSetDataEvent($this$modelData);
            $dispatcher->dispatch($event, FormEvents::POST_SET_DATA);
        }

        return $this;
    }

    public function getData(): mixed
    {
        if ($this->inheritData) {
            if (!$this->parent) {
                throw new RuntimeException('The form is configured to inherit its parent\'s data, but does not have a parent.');
            }
Home | Imprint | This part of the site doesn't use cookies.