<?php

namespace App\Controller;

use App\Entity\Orders;
use App\Form\OrdersType;
use App\Repository\OrdersRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Psr\Log\LoggerInterface;

#[Route('/orders')]
class OrdersController extends AbstractController
{
    private $logger;
    private $ordersRepository;

    public function index(
      OrdersRepository $ordersRepository,
      LoggerInterface $logger
    )
    {
      $this->logger = $logger;
      $this->ordersRepository = $ordersRepository;
    }


    public function getOrders(): Orders
    {
        $this->logger->info('I just got the logger');

        $orders = $this->ordersRepository->findAll();


        return $orders->getData();
    }

}
