Advertisement
nhorquender

parking

Aug 10th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.52 KB | None | 0 0
  1.         $parkingSpacesOficina = $this->find('all', array(
  2.             'fields' => array ($this->alias.'.id', $this->alias.'.name'),
  3.             'conditions' => array(
  4.                 'OPS.office_id' => 1,
  5.                 'U.id' => $idUser,
  6.                 $this->alias.'.type' => VISITOR,
  7.                 $this->alias.'.taken' => false
  8.             ),
  9.             'joins' => array(
  10.                 array(
  11.                     'table' => 'offices_parking_spaces',
  12.                     'alias' => 'OPS',
  13.                     'conditions' => 'OPS.parking_spaces_id = ParkingSpace.id',
  14.                     'type' => 'INNER'
  15.                 ),
  16.                 array(
  17.                     'table' => 'users',
  18.                     'alias' => 'U',
  19.                     'conditions' => 'OPS.office_id = U.office_id',
  20.                     'type' => 'INNER'
  21.                 )
  22.             )
  23.         ));
  24.        
  25.         $parkingSpacesReservadosVisitantesEnHorario = $this->find('all', array(
  26.             'fields' => array ($this->alias.'.id', $this->alias.'.name', 'R.license_plate_number', 'R.reserved_date_start', 'R.reserved_date_end', 'V.name', 'V.last_name'),
  27.             'conditions' => array(
  28.                 '? BETWEEN R.reserved_date_start and R.reserved_date_end' => array($startDate),
  29.                 '? BETWEEN R.reserved_date_start and R.reserved_date_end' => array($endDate),
  30.                 $this->alias.'.type' => VISITOR,
  31.                 $this->alias.'.taken' => false
  32.             ),
  33.             'joins' => array(
  34.                 array(
  35.                     'table' => 'reservations',
  36.                     'alias' => 'R',
  37.                     'conditions' => 'R.parking_spaces_id = ParkingSpace.id',
  38.                     'type' => 'INNER'
  39.                 ),
  40.                 array(
  41.                     'table' => 'visitors',
  42.                     'alias' => 'V',
  43.                     'conditions' => 'R.visitor_id = V.id',
  44.                     'type' => 'INNER'
  45.                 )
  46.             )
  47.         ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement