plugin/announcement/Listener/Resource/AnnouncementListener.php
public function load(LoadResourceEvent $event)
    {
        $resource = $event->getResource();
        $workspace = $resource->getResourceNode()->getWorkspace();

        $event->setData([
            'announcement' => $this->serializer->serialize($resource),
            'workspaceRoles' => array_map(function (Role $role) {
                return $this->serializer->serialize($role, [Options::SERIALIZE_MINIMAL]);
            }, $workspace->getRoles()->toArray()),
        ]);

        $event->stopPropagation();
    }
public function load(LoadResourceEvent $event)
    {
        $resource = $event->getResource();
        $workspace = $resource->getResourceNode()->getWorkspace();

        $event->setData([
            'announcement' => $this->serializer->serialize($resource),
            'workspaceRoles' => array_map(function (Role $role) {
                return $this->serializer->serialize($role, [Options::SERIALIZE_MINIMAL]);
            }, $workspace->getRoles()->toArray()),
        ]);

        $event->stopPropagation();
    }
public function load ( LoadResourceEvent $ event ) { $ resource = $ event -> getResource ( ) ; $ workspace = $ resource -> getResourceNode ( ) -> getWorkspace ( ) ; $ event -> setData ( [ 'announcement' => $ this -> serializer -> serialize ( $ resource ) , 'workspaceRoles' => array_map ( function ( Role $ role ) { return $ this -> serializer -> serialize ( $ role , [ Options :: SERIALIZE_MINIMAL ] ) ; } , $ workspace -> getRoles ( ) -> toArray ( ) ) , ] ) ; $ event -> stopPropagation ( ) ; }
Loads an Announcement resource.

@DI\Observe("resource.claroline_announcement_aggregate.load")

@param LoadResourceEvent $event
Loads an Announcement resource .