mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
WIP: create and edit calendar
This commit is contained in:
@@ -17,6 +17,7 @@ use Chill\CalendarBundle\RemoteCalendar\Connector\RemoteCalendarConnectorInterfa
|
||||
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
@@ -36,20 +37,22 @@ use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
class CalendarController extends AbstractController
|
||||
{
|
||||
protected AuthorizationHelper $authorizationHelper;
|
||||
private AuthorizationHelper $authorizationHelper;
|
||||
|
||||
protected EventDispatcherInterface $eventDispatcher;
|
||||
private EventDispatcherInterface $eventDispatcher;
|
||||
|
||||
protected LoggerInterface $logger;
|
||||
private LoggerInterface $logger;
|
||||
|
||||
protected PaginatorFactory $paginator;
|
||||
private PaginatorFactory $paginator;
|
||||
|
||||
protected SerializerInterface $serializer;
|
||||
private SerializerInterface $serializer;
|
||||
|
||||
private CalendarRepository $calendarRepository;
|
||||
|
||||
private RemoteCalendarConnectorInterface $remoteCalendarConnector;
|
||||
|
||||
private UserRepository $userRepository;
|
||||
|
||||
public function __construct(
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
CalendarRepository $calendarRepository,
|
||||
@@ -57,7 +60,8 @@ class CalendarController extends AbstractController
|
||||
LoggerInterface $logger,
|
||||
PaginatorFactory $paginator,
|
||||
RemoteCalendarConnectorInterface $remoteCalendarConnector,
|
||||
SerializerInterface $serializer
|
||||
SerializerInterface $serializer,
|
||||
UserRepository $userRepository
|
||||
) {
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
$this->calendarRepository = $calendarRepository;
|
||||
@@ -66,6 +70,7 @@ class CalendarController extends AbstractController
|
||||
$this->paginator = $paginator;
|
||||
$this->remoteCalendarConnector = $remoteCalendarConnector;
|
||||
$this->serializer = $serializer;
|
||||
$this->userRepository = $userRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -277,8 +282,13 @@ class CalendarController extends AbstractController
|
||||
// }
|
||||
|
||||
$entity = new Calendar();
|
||||
$entity->setUser($this->getUser());
|
||||
$entity->setStatus($entity::STATUS_VALID);
|
||||
if ($request->query->has('mainUser')) {
|
||||
$entity->setMainUser($this->userRepository->find($request->query->getInt('mainUser')));
|
||||
} else {
|
||||
$entity->setMainUser($this->getUser());
|
||||
}
|
||||
|
||||
dump($entity);
|
||||
|
||||
// if ($user instanceof User) {
|
||||
// $entity->setPerson($user);
|
||||
|
Reference in New Issue
Block a user