dbp/relay-base-course-bundle
最新稳定版本:v0.2.16
Composer 安装命令:
composer require dbp/relay-base-course-bundle
包简介
README 文档
README
Base Symfony bundle for courses for the DBP Relay API Server.
Integration into the Relay API Server
- Add the bundle package as a dependency:
composer require dbp/relay-base-course-bundle
- Add the bundle to your
config/bundles.php:
... Dbp\Relay\BasePersonBundle\DbpRelayBaseCourseBundle::class => ['all' => true], ... ];
- Run
composer installto clear caches
Course provider implementation
For this bundle to work you need to add a service that implements the CourseProviderInterface to your application.
Example
Service class
For example, create a service src/Service/CourseProvider.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; } ... }
Services configuration
For the example service above you need to add the following to your src/Resources/config/services.yaml:
Dbp\Relay\BaseCourseBundle\API\CourseProviderInterface: '@App\Service\CourseProvider'
统计信息
- 总下载量: 17.02k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2023-03-01