Creating Object with Form Elements

Is there a way of building an object with form elements for example if i wanted to created a new car object. Id have a form with car name, colour, etc. All id have to do is fill out the form and on submit the new object would be made. any ideas?

Hi,

have a look at symfony forms: https://symfony.com/doc/current/forms.html

cheers

It is quite simple. If you have got not working code I can look at it.

Have a look here: https://github.com/coreshop/CoreShop/blob/master/src/CoreShop/Bundle/CustomerBundle/Form/CustomerType.php

To be clear, the Form inherits from AbstractResourceType, which injects and sets the data_class option:

you than can either instantiate forms using the FormFactory or reuse it inside other forms:

Creation of the form is done here then:

A more simple example is here: https://github.com/pimcore/pimcore/blob/master/install-profiles/demo-basic-twig/src/AppBundle/Controller/ContentController.php#L57

This should give you a head start into forms.

Cheers

1 Like

Thank you @dpfaffenbauer! :slight_smile:

I’m also now trying to use https://github.com/dachcom-digital/pimcore-formbuilder which works with Pimcore 6.3

However documentation is currently limited, see https://github.com/dachcom-digital/pimcore-formbuilder/issues/95 for additional discussion on usage.