55

I set up a parameter as array, as described in http://jmsyst.com/libs/serializer/master/reference/annotations

class QuestionAnswer
{
    /**
   * @JMS\Type("ArrayCollection<Rest\Bundle\Entity\Fixture\QuestionOptions>")
     * @Groups({"QuestionAnswer"})
   */
      public $question_options_array ;
}

and define some options in another class

class QuestionOptions
{
    /**
       * @JMS\Type("integer")
       * @Groups({"get_option"})
       */
      public $question_option_id ;

      /**
       * @JMS\Type("string")
       * @Groups({"post_option"})
       */
      public $question_option_description;
}

In @ApiDoc I define

     * input={
     *      "class" = "Rest\BeautyBundle\Entity\Fixture\ProfileQuestionAnswer", 
     *      "groups"={"QuestionAnswer", "get_option"},
     *  },

Before updating it works well. But after composer update only the "QuestionAnswer" group name works and it shows all properties from QuestionOptions class. How can I submit properties in the array the way it was before the update?

Alfro
  • 458
  • 9
  • 22
Hayk Grigoryan
  • 651
  • 7
  • 13
  • 2
    Seems like a bug on either library. You should go to NelmioApiDoc on github and report. – NabLa Dec 11 '15 at 14:28
  • Try use `composer install` instead of `composer update`. Also you can change your composer.json to a previous version of this library? – Felippe Duarte May 04 '16 at 17:01

2 Answers2

1

Wow quite odd. Something very similar happened with me in the past and It seems to be an API issue. Nothing on the code end that us developers can do. No one has found a workaround or fix either.

Colin
  • 865
  • 1
  • 6
  • 23
0

marcin-jozwikowski commented on Nov 25, 2020

OK, I got it working! The answer is as old as it gets: clear the cache. At least that's what it was in my case. There's also a requirement in Serializer manual to install sensio/framework-extra-bundle but it work for me without it.

Original comment: https://github.com/nelmio/NelmioApiDocBundle/issues/1167#issuecomment-733909426

Serghei Niculaev
  • 513
  • 7
  • 17