profileRyan KesPGP keyI build stuffEmailGithubTwitterLast.fmMastodonMatrix

@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>

Related