fix: only use destination's pickup values
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\BusProNet\Model\Pickup;
|
||||
use App\Entity\Traits\SoftDeletableEntity;
|
||||
use App\Entity\Traits\TimestampableEntity;
|
||||
use App\Repository\DestinationRepository;
|
||||
@@ -171,6 +172,17 @@ class Destination implements TimestampableEntityInterface, SoftDeletableEntityIn
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPickup(int $id): ?Pickup
|
||||
{
|
||||
foreach ($this->getPickups() as $pickup) {
|
||||
if ($id === $pickup['busProId']) {
|
||||
return Pickup::fromArray($pickup);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function hasBusTransfer(): bool
|
||||
{
|
||||
return 0 < count($this->getPickups());
|
||||
|
||||
Reference in New Issue
Block a user