Skip to content

Commit

Permalink
Merge pull request #793 from kriswallsmith/master
Browse files Browse the repository at this point in the history
do not disappear type params in DoctrineProxySubscriber
  • Loading branch information
goetas authored Jul 4, 2017
2 parents 3617f8d + 8736409 commit 22b5927
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/EventDispatcher/Subscriber/DoctrineProxySubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function onPreSerialize(PreSerializeEvent $event)
$object->__load();

if (!$virtualType) {
$event->setType(get_parent_class($object));
$event->setType(get_parent_class($object), $type['params']);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ public function testListenersDoNotChangeTypeOnProxiesAndVirtualTypes()
$this->assertSame(['name' => 'foo', 'params' => []], $event->getType());
}

public function testOnPreSerializeMaintainsParams()
{
$object = new SimpleObjectProxy('foo', 'bar');
$type = ['name' => SimpleObjectProxy::class, 'params' => ['baz']];

$event = $this->createEvent($object, $type);
$this->subscriber->onPreSerialize($event);

$this->assertSame(['name' => SimpleObject::class, 'params' => ['baz']], $event->getType());
}

protected function setUp()
{
$this->subscriber = new DoctrineProxySubscriber();
Expand Down

0 comments on commit 22b5927

Please sign in to comment.