Skip to content

Latest commit

 

History

History
47 lines (35 loc) · 1.41 KB

lti-registration.md

File metadata and controls

47 lines (35 loc) · 1.41 KB

Fetching LTI Registration through gRPC

<?php

use OAT\Library\EnvironmentManagementClient\Repository\LtiRegistrationRepositoryInterface;
use OAT\Library\EnvironmentManagementClient\Grpc\LtiRegistrationRepository;

class MyService {
    /** @var LtiRegistrationRepositoryInterface  */
    private $ltiRegistrationRepository;
    
    public function __construct(LtiRegistrationRepositoryInterface $ltiRegistrationRepository)
    {
        $this->ltiRegistrationRepository = $ltiRegistrationRepository;
    }
    
    public function myMethod(): void
    {
        //...
        
        $registration = $this->ltiRegistrationRepository->find(new TenantId('t1'), 'reg-1');
        
        //...
        
        $ltiRegistrationCollection = $this->ltiRegistrationRepository->findAll(
            new TenantId('t1'),
            'client-id',
            'platform-iss', 
            'tool-iss'
        );
        
        $ltiRegistrationCollection->isEmpty();
        $ltiRegistrationCollection->has('reg-1');
        $ltiRegistrationCollection->get('reg-1');
        $ltiRegistrationCollection->all();
        
        //...
    }
}

$myService = new MyService(new LtiRegistrationRepository());
$myService->myMethod();