ssossossosso

Forums

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

This topic contains 7 replies, has 2 voices, and was last updated by  kelton23om 3 years ago.

  • Creator
    Topic
  • #5411

    kelton23om
    Participant

    Hi oro’s guys,
    I have an issues when i try to update my custom entity using a REST API.

    I create an entity with my own controller, my own Form type and handler.. etc..
    To do that, i duplicate(almost) an existing case in the OroPlatform..

    My problem seems to appear during the processForm, where the form submit do not hydrate data from the Request.

    Do you have any idea where that is come from ?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #5418

    Alexandr Smaga
    Participant

    Hello @kelton23om!
    Could you please provide more details? Are you talking about REST api ? Are you working with named form ?

    #5433

    kelton23om
    Participant

    Hi,

    Yes i talk about a REST API.. i try to build my own REST API to expose my Own webservices dedicates to my Custom entity.
    To do that, i decided to follow an example as in the NotesBundle.. and it’s work pretty well for “delete” and “get” web services, but i encouter a problem when i try to PUT or POST some data.
    After some explorations i realize that the problem come from the Form process method,
    the submit method to be more precise who did not do the job!

    I don’t really known why, but the model Object is never hydrated by the request data..
    whereas if i trace my request i can see form data in the parameter bag.

    i expect that explains a bit more the situation.

    thanks again to spend a bit of your time answer my questions 🙂

    #5436

    Alexandr Smaga
    Participant

    Can you share $this->form->getName(), var_dump(array_keys($this->form->all())) and var_dump($this->request->request->all()); ?

    #5437

    kelton23om
    Participant

    Hi, of course here it is:

    $this->form->getName()

    var_dump(array_keys($this->form->all()));

    var_dump($this->request->request->all());

    #5497

    Alexandr Smaga
    Participant

    Hello.

    Please try to use

    #5519

    kelton23om
    Participant

    Hi,

    I’m not sure to do the right thing, but i get a 404 error !!!

    :/

    #5597

    kelton23om
    Participant

    I found from where my issue came…

    It’s because of the form service declaration and the way the RestController manage the request.

    in “Oro\Bundle\SoapBundle\Controller\Api\Rest\RestController” the “fixRequestAttributes” method handle the parameters from Request.

    the problem is that this method treats the request as a “GET” if the “Form” contains a name.

    And of course in my case i put a name in my form declaration, in the “service.yml”:

    So i just need to remove the name from the arguments like this:

    that’s it 🙂

    I’m not really sure about the meaning of the fixRequestAttributes method but it seems to have a quite strange behavior in my opinion!

    thanks again!! keep going your good work

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

You must be logged in to reply to this topic.