public function load(string $type, string $context, $contextId = null, array $options = null)
    {
        $user = null;
        if ($this->tokenStorage->getToken()->getUser() instanceof User) {
            $user = $this->tokenStorage->getToken()->getUser();
        }

        $workspace = null;
        if (DataSource::CONTEXT_WORKSPACE === $context) {
            $workspace = $this->om
                ->getRepository(Workspace::class)
                ->findOneBy(['uuid' => $contextId]);
        }

        /** @var GetDataEvent $event */
        $event = $this->eventDispatcher->dispatch(
            'data_source.'.$type.'.load',
            GetDataEvent::class,
            [$context, $options, $user, $workspace]
        );

        return $event->getData();
    }
public function load(string $type, string $context, $contextId = null, array $options = null)
    {
        $user = null;
        if ($this->tokenStorage->getToken()->getUser() instanceof User) {
            $user = $this->tokenStorage->getToken()->getUser();
        }

        $workspace = null;
        if (DataSource::CONTEXT_WORKSPACE === $context) {
            $workspace = $this->om
                ->getRepository(Workspace::class)
                ->findOneBy(['uuid' => $contextId]);
        }

        /** @var GetDataEvent $event */
        $event = $this->eventDispatcher->dispatch(
            'data_source.'.$type.'.load',
            GetDataEvent::class,
            [$context, $options, $user, $workspace]
        );

        return $event->getData();
    }
public function load ( string $ type , string $ context , $ contextId = null , array $ options = null ) { $ user = null ; if ( $ this -> tokenStorage -> getToken ( ) -> getUser ( ) instanceof User ) { $ user = $ this -> tokenStorage -> getToken ( ) -> getUser ( ) ; } $ workspace = null ; if ( DataSource :: CONTEXT_WORKSPACE === $ context ) { $ workspace = $ this -> om -> getRepository ( Workspace :: class ) -> findOneBy ( [ 'uuid' => $ contextId ] ) ; } /** @var GetDataEvent $event */ $ event = $ this -> eventDispatcher -> dispatch ( 'data_source.' . $ type . '.load' , GetDataEvent :: class , [ $ context , $ options , $ user , $ workspace ] ) ; return $ event -> getData ( ) ; }
Loads data from a data source.

@param string $type
@param string $context
@param string $contextId
@param array  $options

@return mixed
Loads data from a data source .