rdv: set the calendar ranges as an API point + fetch them into the calendar view

This commit is contained in:
nobohan
2021-08-16 19:22:29 +02:00
parent 323434f34e
commit 02a9e21f62
4 changed files with 144 additions and 6 deletions

View File

@@ -7,6 +7,7 @@ use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\HttpFoundation\Request;
/**
* This is the class that loads and manages your bundle configuration.
@@ -33,6 +34,7 @@ class ChillCalendarExtension extends Extension implements PrependExtensionInterf
public function prepend(ContainerBuilder $container)
{
$this->preprendRoutes($container);
$this->prependCruds($container);
}
protected function preprendRoutes(ContainerBuilder $container)
@@ -47,5 +49,36 @@ class ChillCalendarExtension extends Extension implements PrependExtensionInterf
]);
}
/**
* @param ContainerBuilder $container
*/
protected function prependCruds(ContainerBuilder $container)
{
$container->prependExtensionConfig('chill_main', [
'apis' => [
[
'class' => \Chill\CalendarBundle\Entity\CalendarRange::class,
'name' => 'calendar_range',
'base_path' => '/api/1.0/calendar/calendar-range',
'base_role' => 'ROLE_USER',
'actions' => [
'_index' => [
'methods' => [
Request::METHOD_GET => true,
Request::METHOD_HEAD => true
],
],
'_entity' => [
'methods' => [
Request::METHOD_GET => true,
Request::METHOD_HEAD => true
]
],
]
]
]
]);
}
}