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

Forums OroPlatform OroPlatform – How do I? Questions Use EntityType in FormType, reused by JSON API endpoint

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

  • Creator
  • #3593



    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)
Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.

You will be redirected to [title]. Would you like to continue?

Yes No