Skip to content

Instantly share code, notes, and snippets.

@merltron-pa
Last active November 27, 2020 14:22
Show Gist options
  • Save merltron-pa/8293d52befb9b6a5396afa77b6d61ef3 to your computer and use it in GitHub Desktop.
Save merltron-pa/8293d52befb9b6a5396afa77b6d61ef3 to your computer and use it in GitHub Desktop.
PHP/JMS Article: Expose and configure types for entity
<?php
...
use JMS\Serializer\Annotation as Serializer;
/**
* @Serializer\ExclusionPolicy("all")
*/
class Address
{
/**
* @Serializer\Expose()
* @Serializer\Type("string")
*
* @var string|null
*/
private $name;
/**
* @Serializer\Expose()
* @Serializer\Type("string")
* @Serializer\SerializedName("line1")
*
* @var string|null
*/
private $lineOne;
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment