Newer
Older
[GitLab](https://gitlab.tugraz.at/dbp/relay/dbp-relay-base-course-bundle)
```
* Add the bundle to your `config/bundles.php`:
```php
...
Dbp\Relay\BasePersonBundle\DbpRelayBaseCourseBundle::class => ['all' => true],
...
];
```
* Run `composer install` to clear caches
For this bundle to work you need to add a service that implements the
[CourseProviderInterface](https://gitlab.tugraz.at/dbp/relay/dbp-relay-base-course-bundle/-/blob/main/src/API/CourseProviderInterface.php)
to your application.
For example, create a service `src/Service/CourseProvider.php`:
```php
<?php
namespace App\Service;
use Dbp\Relay\BaseCourseBundle\API\CourseProviderInterface;
use Dbp\Relay\BaseCourseBundle\Entity\Course;
class CourseProvider implements CourseProviderInterface
{
public function getCourseById(string $identifier, array $options = []): ?Course
{
$course = new Course();
$course->setIdentifier($identifier);
$course->setName('Field Theory');
$course->setDescription('News from field theory');
return $course;
}
...
}
```
For the example service above you need to add the following to your `src/Resources/config/services.yaml`:
```yaml
Dbp\Relay\BaseCourseBundle\API\CourseProviderInterface:
'@App\Service\CourseProvider'