PHP code example of dbp / relay-base-course-connector-campusonline-bundle

1. Go to this page and download the library: Download dbp/relay-base-course-connector-campusonline-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dbp / relay-base-course-connector-campusonline-bundle example snippets


...
Dbp\Relay\BasePersonBundle\DbpRelayBaseCourseBundle::class => ['all' => true],
Dbp\Relay\BasePersonBundle\DbpRelayBaseCourseConnectorCampusonlineBundle::class => ['all' => true],
...


namespace App\EventSubscriber;

use Dbp\Relay\BaseCourseConnectorCampusonlineBundle\Event\CoursePostEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class CourseEventSubscriber implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            CoursePostEvent::NAME => 'onPost',
    ];
    }

    public function onPost(CoursePostEvent $event)
    {
        $course = $event->getCourse();
        $courseData = $event->getCourseData();
        $course->trySetLocalDataValue('code', $courseData->getCode());
    }
}