mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-25 21:16:21 +00:00
31 lines
511 B
Markdown
31 lines
511 B
Markdown
|
---
|
||
|
id: b4612276-2244-4ad6-b3cd-f7e59a2da999
|
||
|
title: "@SerializedName"
|
||
|
---
|
||
|
|
||
|
# Introduction
|
||
|
|
||
|
From [Symfony 4.2](20201111101706-symfony_4_2), it's possible to
|
||
|
configure name conversion rules using metadata.
|
||
|
|
||
|
# Syntax
|
||
|
|
||
|
``` php
|
||
|
namespace App\Entity;
|
||
|
|
||
|
use Symfony\Component\Serializer\Annotation\SerializedName;
|
||
|
|
||
|
class Person
|
||
|
{
|
||
|
/** @SerializedName("customer_name") */
|
||
|
private $firstName;
|
||
|
|
||
|
public function __construct(string $firstName)
|
||
|
{
|
||
|
$this->firstName = $firstName;
|
||
|
}
|
||
|
|
||
|
// ...
|
||
|
}
|
||
|
```
|