<commit_before>Creating new resource
=====================

To display a form, handle submit or create a new resource via API, you should use **createAction** of your **app.controller.user** service.

.. code-block:: yaml

    # routing.yml

    app_user_create:
        path: /users/new
        methods: [GET, POST]
        defaults:
            _controller: app.controller.user:createAction

Done! Now when you go to ``/users/new``, ResourceController will use the repository (``app.repository.user``) to create new user instance.
Then it will try to create an ``app_user`` form, and set the newly created user as data.

.. note::

    Currently, this bundle does not generate a form for you, the right form type has to be created and registered in the container manually.

As a response, it will render the ``App:User:create.html.twig`` template with form view as the ``form`` variable.

Declaring your form as a service
--------------------------------

As said previously, you need to declare your form as a service. Its name must be contructed with the following pattern ``application_resource`` (Example: ``sylius_product``).
(see the **Configuration** chapter to see how configure your resources and your application name)

.. code-block:: xml

    <parameters>
        <!-- If you use the basic configuration this paramter is not available in the container. You need to add it manually. -->
        <parameter key="app.form.type.user.class">App\Byndle\Form\UserType</parameter>
    </parameters>

    <services>
        <service id="app.form.type.user" class="%app.form.type.user.class%">
            <tag name="form.type" alias="app_user" />
        </service>
    </services><commit_msg>Fix typo in create resource documentation<commit_after>Creating new resource
=====================

To display a form, handle submit or create a new resource via API, you should use **createAction** of your **app.controller.user** service.

.. code-block:: yaml

    # routing.yml

    app_user_create:
        path: /users/new
        methods: [GET, POST]
        defaults:
            _controller: app.controller.user:createAction

Done! Now when you go to ``/users/new``, ResourceController will use the repository (``app.repository.user``) to create new user instance.
Then it will try to create an ``app_user`` form, and set the newly created user as data.

.. note::

    Currently, this bundle does not generate a form for you, the right form type has to be created and registered in the container manually.

As a response, it will render the ``App:User:create.html.twig`` template with form view as the ``form`` variable.

Declaring your form as a service
--------------------------------

As said previously, you need to declare your form as a service. Its name must be contructed with the following pattern ``application_resource`` (Example: ``sylius_product``).
(see the **Configuration** chapter to see how configure your resources and your application name)

.. code-block:: xml

    <parameters>
        <!-- If you use the basic configuration this paramter is not available in the container. You need to add it manually. -->
        <parameter key="app.form.type.user.class">App\Bundle\Form\UserType</parameter>
    </parameters>

    <services>
        <service id="app.form.type.user" class="%app.form.type.user.class%">
            <tag name="form.type" alias="app_user" />
        </service>
    </services>
{'fraction_non_alphanumeric': 0.12967289719626168, 'fraction_numerical': 0.0, 'mean_word_length': 3.187041564792176, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7479890', 'n_tokens_mistral': 906, 'n_tokens_neox': 881, 'n_words': 386}