initForm example


    private function getForm(Plugin $plugin)
    {
        /** @var Form|null $form */
        $form = $this->formRepository->findOneBy([
            'pluginId' => $plugin->getId(),
        ]);

        if (!$form) {
            $form = $this->initForm($plugin);
        }

        return $form;
    }

    /** * @return Form */
    private function initForm(Plugin $plugin)
    {
        $form = new Form();
        
final public function Forms(): EntityRepository
    {
        return Shopware()->Models()->getRepository(Form::class);
    }

    /** * Returns plugin form */
    final public function Form(): Form
    {
        if (!$this->hasForm()) {
            $this->form = $this->initForm();
        }

        if ($this->form === null) {
            throw new RuntimeException('Plugin form was not initialized correctly');
        }

        return $this->form;
    }

    final public function hasForm(): bool
    {
        
Home | Imprint | This part of the site doesn't use cookies.