Reservas
This commit is contained in:
@ -68,7 +68,7 @@ class Reservation extends Common\Ideal\Model
|
||||
public function addUnit(Model\Venta\Unidad $unit, float $value): self
|
||||
{
|
||||
if (($i = $this->findUnit($unit->id)) !== null) {
|
||||
$this->units[$i]['value'] = $value;
|
||||
$this->units[$i]->value = $value;
|
||||
return $this;
|
||||
}
|
||||
$this->units[] = (object) [
|
||||
@ -88,12 +88,7 @@ class Reservation extends Common\Ideal\Model
|
||||
}
|
||||
public function findUnit(int $unit_id): ?int
|
||||
{
|
||||
foreach ($this->units as $idx => $unit) {
|
||||
if ($unit['unit']->id == $unit_id) {
|
||||
return $idx;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return array_find_key($this->units, fn($unit) => $unit->unit->id == $unit_id);
|
||||
}
|
||||
public function hasUnit(int $unit_id): bool
|
||||
{
|
||||
|
Reference in New Issue
Block a user