mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-21 19:16:23 +00:00
809 B
809 B
date | id | title |
---|---|---|
2020-11-16 | 74ad0664-3103-429c-b9b7-15b1ea8e0c2c | @Ignore |
Description
Ignore values when serializing
Syntax
use Symfony\Component\Serializer\Annotation\Ignore;
class SomeClass
{
public $someProperty;
/**
* @Ignore()
*/
public $anotherProperty;
private $lastProperty;
/**
* @Ignore()
*/
public function getLastProperty()
{
return $this->lastProperty;
}
}
App\SomePath\SomeClas:
attributes:
# ...
anotherProperty:
ignore: true
lastProperty:
ignore: true
<class name="App\SomePath\SomeClass">
<!-- ... -->
<attribute name="anotherProperty" ignore="true" />
<attribute name="lastProperty" ignore="true" />
</class>