FIX: Fetch by state
This commit is contained in:
@ -134,11 +134,10 @@ class Reservation extends Common\Ideal\Repository
|
||||
->joined("INNER JOIN ({$sub1}) er0 ON er0.id = er1.id");
|
||||
|
||||
$query = $this->connection->getQueryBuilder()
|
||||
->select()
|
||||
->from('reservations')
|
||||
->joined("INNER JOIN ({$sub2}) er ON er.reservation_id = reservations.id")
|
||||
->where('project_id = :project_id AND er.type = :state');
|
||||
|
||||
->select('a.*')
|
||||
->from("{$this->getTable()} a")
|
||||
->joined("INNER JOIN ({$sub2}) er ON er.reservation_id = a.id")
|
||||
->where('a.project_id = :project_id AND er.type = :state');
|
||||
return $this->fetchMany($query, ['project_id' => $project_id,
|
||||
'state' => $state]);
|
||||
}
|
||||
@ -178,7 +177,10 @@ class Reservation extends Common\Ideal\Repository
|
||||
public function fetchRejected(int $project_id): array
|
||||
{
|
||||
try {
|
||||
return $this->fetchState($project_id, Model\Venta\Reservation\State\Type::REJECTED->value);
|
||||
return [
|
||||
...$this->fetchState($project_id, Model\Venta\Reservation\State\Type::REJECTED->value),
|
||||
...$this->fetchState($project_id, Model\Venta\Reservation\State\Type::CANCELLED->value)
|
||||
];
|
||||
} catch (InvalidState $exception) {
|
||||
throw new Common\Implement\Exception\EmptyResult('Select rejected reservations', $exception);
|
||||
}
|
||||
|
Reference in New Issue
Block a user