fix: find destinations by hotel code in favor of ids
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\Controller\HouseManager\Feedback;
|
||||
|
||||
use App\BusProNet\DataProvider\HotelDataProvider;
|
||||
use App\BusProNet\Model\Hotel;
|
||||
use App\Entity\User;
|
||||
use App\Repository\DispositionRepository;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
@@ -17,7 +15,6 @@ class IndexController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly DispositionRepository $dispositionRepository,
|
||||
private readonly HotelDataProvider $hotelDataProvider,
|
||||
private readonly PaginatorInterface $paginator
|
||||
) {
|
||||
}
|
||||
@@ -29,18 +26,9 @@ class IndexController extends AbstractController
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
|
||||
$hotels = $this
|
||||
->hotelDataProvider
|
||||
->findByCode($user->getHotelCode())
|
||||
;
|
||||
|
||||
$hotelBusProIds = array_map(function (Hotel $hotel) {
|
||||
return $hotel->getBusProId();
|
||||
}, $hotels);
|
||||
|
||||
$query = $this
|
||||
->dispositionRepository
|
||||
->getDispositionsWithPendingFeedbackQuery($hotelBusProIds)
|
||||
->getDispositionsWithPendingFeedbackQuery($user->getHotelCode())
|
||||
;
|
||||
|
||||
$pagination = $this->paginator->paginate(
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Controller\HouseManager;
|
||||
|
||||
use App\BusProNet\DataProvider\HotelDataProvider;
|
||||
use App\BusProNet\Model\Hotel;
|
||||
use App\Entity\User;
|
||||
use App\Repository\DispositionRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
@@ -31,18 +30,14 @@ class IndexController extends AbstractController
|
||||
->findByCode($user->getHotelCode())
|
||||
;
|
||||
|
||||
$hotelBusProIds = array_map(function (Hotel $hotel) {
|
||||
return $hotel->getBusProId();
|
||||
}, $hotels);
|
||||
|
||||
$newDispositions = $this
|
||||
->dispositionRepository
|
||||
->findNewDispositionsByHotelBusProIds($hotelBusProIds)
|
||||
->findNewDispositionsByHotelCode($user->getHotelCode())
|
||||
;
|
||||
|
||||
$pendingFeedbacks = $this
|
||||
->dispositionRepository
|
||||
->findDispositionsWithPendingFeedbackByHotelBusProIds($hotelBusProIds)
|
||||
->findDispositionsWithPendingFeedbackByHotelCode($user->getHotelCode())
|
||||
;
|
||||
|
||||
return $this->render('house_manager/index.html.twig', [
|
||||
|
||||
Reference in New Issue
Block a user