Skip to content

Instantly share code, notes, and snippets.

@tsh-code
Created December 12, 2018 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsh-code/fe8fba719a06be4bfbab900d510511ac to your computer and use it in GitHub Desktop.
Save tsh-code/fe8fba719a06be4bfbab900d510511ac to your computer and use it in GitHub Desktop.
<?php
// ..
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"flashcardList"}},
* denormalizationContext={"groups"={"flashcardCreate"}}
* )
* ...
*/
class Flashcard
{
/**
* ...
* @Groups({"flashcardList"})
*/
private $id;
/**
* ...
* @Groups({"flashcardList", "flashcardCreate"})
*/
public $question;
/**
* ...
* @Groups({"flashcardList", "flashcardCreate"})
*/
public $answer;
/**
* ...
* @Groups({"flashcardCreate"})
*/
public $lesson;
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment