getNormalizerForIgnoredAttributes example

/** * Test AbstractNormalizer::IGNORED_ATTRIBUTES. */
trait IgnoredAttributesTestTrait
{
    abstract protected function getNormalizerForIgnoredAttributes(): NormalizerInterface;

    abstract protected function getDenormalizerForIgnoredAttributes(): DenormalizerInterface;

    public function testIgnoredAttributesNormalize()
    {
        $normalizer = $this->getNormalizerForIgnoredAttributes();

        $objectInner = new ObjectInner();
        $objectInner->foo = 'innerFoo';
        $objectInner->bar = 'innerBar';

        $objectOuter = new ObjectOuter();
        $objectOuter->foo = 'foo';
        $objectOuter->bar = 'bar';
        $objectOuter->setInner($objectInner);

        $context = ['ignored_attributes' => ['bar']];
        
Home | Imprint | This part of the site doesn't use cookies.