public function testDoesNotRewriteCustomType() { $event = $this->createEvent($obj = new SimpleObjectProxy('a', 'b'), array('name' => 'FakedName', 'params' => array())); $this->subscriber->onPreSerialize($event); $this->assertEquals(array('name' => 'FakedName', 'params' => array()), $event->getType()); $this->assertTrue($obj->__isInitialized()); }
public function onPreSerialize(PreSerializeEvent $event) { $type = $event->getType(); // A HalCollection type mustn't ever be serialized as ArrayCollection for Doctrine's // {*}Collection objects (see parent class). if ($type['name'] == 'ZF\\Hal\\Collection') { return; } parent::onPreSerialize($event); }