X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fmodules%2Fearly_rendering_controller_test%2Fsrc%2FTestDomainObjectViewSubscriber.php;fp=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fmodules%2Fearly_rendering_controller_test%2Fsrc%2FTestDomainObjectViewSubscriber.php;h=e6152ca67f107b50e052e4c4aef2d820aa9217f3;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/system/tests/modules/early_rendering_controller_test/src/TestDomainObjectViewSubscriber.php b/web/core/modules/system/tests/modules/early_rendering_controller_test/src/TestDomainObjectViewSubscriber.php new file mode 100644 index 000000000..e6152ca67 --- /dev/null +++ b/web/core/modules/system/tests/modules/early_rendering_controller_test/src/TestDomainObjectViewSubscriber.php @@ -0,0 +1,46 @@ +getControllerResult(); + + if ($result instanceof TestDomainObject) { + if ($result instanceof AttachmentsTestDomainObject) { + $event->setResponse(new AttachmentsTestResponse('AttachmentsTestDomainObject')); + } + elseif ($result instanceof CacheableTestDomainObject) { + $event->setResponse(new CacheableTestResponse('CacheableTestDomainObject')); + } + else { + $event->setResponse(new Response('TestDomainObject')); + } + } + } + + /** + * {@inheritdoc} + */ + public static function getSubscribedEvents() { + $events[KernelEvents::VIEW][] = ['onViewTestDomainObject']; + + return $events; + } + +}