Skip to content

Instantly share code, notes, and snippets.

@tsh-code
Created December 12, 2018 13:39
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/dd02b2d411c0d926c1588196a798827a to your computer and use it in GitHub Desktop.
Save tsh-code/dd02b2d411c0d926c1588196a798827a to your computer and use it in GitHub Desktop.
<?php
// ...
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"userList"}},
* denormalizationContext={"groups"={"userCreate"}}
* )
* ...
*/
class User implements UserInterface
{
/**
* ...
* @Groups({"userList"})
*/
private $id;
/**
* ...
* @Groups({"userList", "userCreate"})
*/
public $name;
/**
* ...
* @Groups({"userCreate"})
*/
public $plainPassword;
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment