mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 11:03:50 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,34 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\CalendarBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
|
||||
class CalendarAPIController extends ApiController
|
||||
{
|
||||
|
||||
|
||||
protected function getContextForSerialization(string $action, Request $request, string $_format, $entity): array
|
||||
{
|
||||
switch($action) {
|
||||
case '_index':
|
||||
switch ($request->getMethod()) {
|
||||
case Request::METHOD_GET:
|
||||
return [ 'groups' => [ 'calendar:read' ] ];
|
||||
}
|
||||
}
|
||||
return parent::getContextForSerialization($action, $request, $_format, $entity);
|
||||
}
|
||||
|
||||
protected function customizeQuery(string $action, Request $request, $qb): void
|
||||
{
|
||||
if ($request->query->has('main_user')) {
|
||||
|
||||
$qb->where('e.mainUser = :main_user')
|
||||
->setParameter('main_user', $request->query->get('main_user'));
|
||||
->setParameter('main_user', $request->query->get('main_user'));
|
||||
}
|
||||
}
|
||||
|
||||
protected function getContextForSerialization(string $action, Request $request, string $_format, $entity): array
|
||||
{
|
||||
switch ($action) {
|
||||
case '_index':
|
||||
switch ($request->getMethod()) {
|
||||
case Request::METHOD_GET:
|
||||
return ['groups' => ['calendar:read']];
|
||||
}
|
||||
}
|
||||
|
||||
return parent::getContextForSerialization($action, $request, $_format, $entity);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user