plugin/agenda/Controller/API/EventController.php
public function listAction(Request $request, $class)
    {
        $query = $request->query->all();
        $hiddenFilters = isset($query['hiddenFilters']) ? $query['hiddenFilters'] : [];
        $query['hiddenFilters'] = array_merge($hiddenFilters, $this->getDefaultHiddenFilters());

        //get start & end date and add them to the hidden filters list
        $query['hiddenFilters']['createdAfter'] = $query['start'];

        //we want to be able to fetch events that start a months before and ends a month after
        $date = new \DateTime($query['end']);
        $interval = new \DateInterval('P2M');
        $date->add($interval);
        $end = $date->format('Y-m-d');

        $query['hiddenFilters']['endBefore'] = $end;

        $data = $this->finder->search(
            $class,
            $query,
            $this->options['list']
        );

        return new JsonResponse($data['data']);
    }
public function listAction(Request $request, $class)
    {
        $query = $request->query->all();
        $hiddenFilters = isset($query['hiddenFilters']) ? $query['hiddenFilters'] : [];
        $query['hiddenFilters'] = array_merge($hiddenFilters, $this->getDefaultHiddenFilters());

        //get start & end date and add them to the hidden filters list
        $query['hiddenFilters']['createdAfter'] = $query['start'];

        //we want to be able to fetch events that start a months before and ends a month after
        $date = new \DateTime($query['end']);
        $interval = new \DateInterval('P2M');
        $date->add($interval);
        $end = $date->format('Y-m-d');

        $query['hiddenFilters']['endBefore'] = $end;

        $data = $this->finder->search(
            $class,
            $query,
            $this->options['list']
        );

        return new JsonResponse($data['data']);
    }
public function listAction ( Request $ request , $ class ) { $ query = $ request -> query -> all ( ) ; $ hiddenFilters = isset ( $ query [ 'hiddenFilters' ] ) ? $ query [ 'hiddenFilters' ] : [ ] ; $ query [ 'hiddenFilters' ] = array_merge ( $ hiddenFilters , $ this -> getDefaultHiddenFilters ( ) ) ; //get start & end date and add them to the hidden filters list $ query [ 'hiddenFilters' ] [ 'createdAfter' ] = $ query [ 'start' ] ; //we want to be able to fetch events that start a months before and ends a month after $ date = new \ DateTime ( $ query [ 'end' ] ) ; $ interval = new \ DateInterval ( 'P2M' ) ; $ date -> add ( $ interval ) ; $ end = $ date -> format ( 'Y-m-d' ) ; $ query [ 'hiddenFilters' ] [ 'endBefore' ] = $ end ; $ data = $ this -> finder -> search ( $ class , $ query , $ this -> options [ 'list' ] ) ; return new JsonResponse ( $ data [ 'data' ] ) ; }
tweaked for fullcalendar.


@param Request $request
@param string  $class

@return JsonResponse
tweaked for fullcalendar .