55

http://jmsyst.com/libs/serializer/master/reference/annotationsで説明されているように、パラメーターを配列として設定しました

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

別のクラスでいくつかのオプションを定義します

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

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

@ApiDoc で定義します

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

更新前は問題なく動作しています。ただしcomposer update、「QuestionAnswer」グループ名のみが機能し、QuestionOptions クラスのすべてのプロパティが表示されます。更新前と同じように、配列内のプロパティを送信するにはどうすればよいですか?

4

2 に答える 2