Forums OroPlatform OroPlatform – Programming Questions REST API for custom entity

This topic contains 2 replies, has 2 voices, and was last updated by  manuel.distefano 1 year, 6 months ago.

  • Creator
  • #28737


    Hello everyone,

    i’m using oro platform and i add a custom Entity (Alumnus) to my project. It’s a “complex” entity, infact it have a relationship (many-to-one) with others custom entities (e.g. Expertise).

    I’m able to create an Alumnus via web, now i’m try to create it via API. I add a REST API (GET – POST – PUT), and i’m able to create an Alumnus. But when i add an array of “Expertises” to my json i get an error.

    I send my request with another php application. My data is in array and i use json_encode before sent it.

    Some code (as us can see i’m using “oro_collection” to add Expertise to Alumnus):

    My Form Type:

    My Entity (Doctrine configuration it’s by yml):

    My json:

    Can someone help me or get me some documentation?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
  • #28738

    Yurii Muratov

    Hi, @manuel-distefano.

    I think that you sent incorrect data for expertises field.

    You should send an array with id’s for this field.

    Please test request with data like:

    Where 1 is id for some record form Expertise



    Hello Yurii,

    yes that was one problem. In any case i solved it by change oro_collection to collection.

    Need oro_collection type a particular structure in json? I’m just curious at the moment 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.