Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 1 reply, has 2 voices, and was last updated by Mike Kudelya Mike Kudelya 8 months, 1 week ago.

  • Creator
  • #32930



    I have created a form type, which looks something like that:

    Such a form without ‘client’ element (which is of Symfony\Bridge\Doctrine\Form\Type\EntityType) works fine both in browser and via API. But I cannot use EntityType via API, because, I as understand, it is not registered as API form type (we want to use JSON API, provided by OroApiBundle).
    Later I have found that ORO platform has its own Oro\Bundle\ApiBundle\Form\Type\EntityType, which I can use via API (but it does not work from browser) if I configure it like this:

    I would like to reuse my form type to create new entities both in browser and in external apps via API. So far, I am thinking about registering this form as two services and use correct entity type, based on the service type:

    This solution would work for us, but I just wanted to get some feedback from ORO team if this is good practice, or if there is a better way to reuse custom form type in API.

    Thank you.

Viewing 1 replies (of 1 total)
  • Author
  • #33004
    Mike Kudelya
    Mike Kudelya
    Oro Core


    As a rule, you should separate two forms into two classes, because it is highly probable that changing the form can break either the API or the UI.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.