访问每个对象并在分页中添加信息[CakePHP 3]

I want to modify an object before getting paginated and displayed in a JSON response, right now my code looks like this :

$this->paginate = [ 
    'conditions' => $this->getPaginationConditions(),
    ]; 
$this->set('reservations', $this->paginate($this->Reservations));
$this->set('_serialize', ['reservations']);

getPaginationConditions() looks like this

private function getPaginationConditions()
{
    $conditions = ['Reservations.id_venue' => $this->Auth->user('id_venue_manager')];  
    if ($date = $this->request->query('date')) {
        $conditions['Reservations.date'] = $date;
    }
    if ($user = $this->request->query('id_user')) {
        $conditions['Reservations.id_user'] = $user;
    }
    return $conditions;
}

This returns :

 {
  "reservations": [
    {
      "id_reservation": 139,
      "reservation_type": "",
      "date": "2017-09-04T00:00:00",
      "time": "2017-03-01T10:00:00",
      "id_venue": 1,
      "id_user": 149,
    },
    {
      "id_reservation": 140,
      "reservation_type": "",
      "date": "2017-09-04T00:00:00",
      "time": "2017-03-01T20:00:00",
      "id_venue": 1,
      "id_user": 149,
    },
    [...]

I want to access each object following my conditions before the pagination and adding a "user" field, I know how to find my user, but I don't know how to access the objects that will get selected by the pagination conditions. It will look like :

 {
  "reservations": [
    {
      "id_reservation": 139,
      "reservation_type": "",
      "date": "2017-09-04T00:00:00",
      "time": "2017-03-01T10:00:00",
      "id_venue": 1,
      "id_user": 149,
      "user" : {
         "firstname" : "test",
         "lastname" : "test",
         "id_user" : "149",
         [...]
      }
    },
    {
      "id_reservation": 140,
      "reservation_type": "",
      "date": "2017-09-04T00:00:00",
      "time": "2017-03-01T20:00:00",
      "id_venue": 1,
      "id_user": 149,
      "user" : {
         "firstname" : "test",
         "lastname" : "test",
         "id_user" : "149",
         [...]
      }
    },
    [...]

Thanks for helping !

You could add 'contain' index on $this->paginate passing the model relationship that you want to add.

<?php 
    $this->paginate = [ 
        'conditions' => $this->getPaginationConditions(),
        'contain' => ['User']
    ]; 
?>