public function testIgnoredAttributes() { $this->normalizer->setIgnoredAttributes(array('foo', 'bar', 'camelCase')); $obj = new PropertyDummy(); $obj->foo = 'foo'; $obj->setBar('bar'); $this->assertEquals(array(), $this->normalizer->normalize($obj, 'any')); }
public function benchSymfonyPropertyNormalizer() { $normalizer = new PropertyNormalizer(); $normalizer->setCallbacks(array('createdAt' => function (\DateTime $date) { return $date->format(\DateTime::RFC3339); })); $normalizer->setIgnoredAttributes(['user', 'password']); $normalizers = array($normalizer); $encoders = array(new JsonEncoder()); $symfony = new Serializer($normalizers, $encoders); return $symfony->serialize($this->data, 'json'); }