src/Controller/FeedController.php line 36

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\Company\CompanyRepository;
  4. use App\Security\SecurityWrapper;
  5. use App\Utils\Payment\Payment;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. use Symfony\Component\DependencyInjection\ContainerInterface;
  10. /**
  11.  * @IsGranted("IS_AUTHENTICATED_FULLY")
  12.  */
  13. class FeedController extends AbstractController
  14. {
  15.     protected $companyRepository;
  16.     /**
  17.      * @var Payment
  18.      */
  19.     protected $paymentService;
  20.     
  21.     public function __construct(CompanyRepository $companyRepositoryPayment $paymentService )
  22.     {
  23.         $this->companyRepository $companyRepository;
  24.         $this->paymentService $paymentService;
  25.         
  26.         
  27.     }
  28.     /**
  29.      * @Route("/feed", name="feed")
  30.      */
  31.     public function index()
  32.     {
  33.         $company $this->companyRepository->findByOwner($this->getUser()->getSlug());
  34.         // if(empty($this->getUser()->getDepartment()) OR empty($this->getUser()->getSections())){
  35.         //     return $this->redirectToRoute('company.request.panding-department');
  36.         // }elseif(empty($this->getUser()->getAccountVerification()->getAccountVerified())){
  37.         //     return $this->redirectToRoute('auth.checking');
  38.         // }elseif(!empty($company) && empty($company->getAccountVerification()->getAccountVerified())){
  39.         //     return $this->redirectToRoute('company.checking.email',["slug" => $company->getSlug()]);
  40.         // }
  41.         if(empty($this->getUser()->getDepartment()) OR empty($this->getUser()->getSections())){
  42.             return $this->redirectToRoute('company.request.panding-department');
  43.         }elseif(!empty($company) && empty($company->getAccountVerification()->getAccountVerified())){
  44.             return $this->redirectToRoute('company.checking.email',["slug" => $company->getSlug()]);
  45.         }
  46.         // elseif(empty($this->getUser()->getProject())){
  47.         //     return $this->redirectToRoute('auth.checking.check-project',["slug" => $this->getUser()->getSlug()]);
  48.         // }
  49.        $summaryCDF $this->paymentService->summaryContributionsCDFByCompany();
  50.        $summaryUSD $this->paymentService->summaryContributionsUSDByCompany();
  51.         return $this->render('feed/index.html.twig', [
  52.             'controller_name'       => 'FeedController',
  53.             'summaryCDF'            => $summaryCDF,
  54.             'summaryUSD'            => $summaryUSD,
  55.             //
  56.             'app_cash_path'         => $this->getParameter("app_cash_path"),
  57.             'app_accounting_path'   => $this->getParameter("app_accounting_path"),
  58.             'app_baadhi_path'       => $this->getParameter("app_baadhi_path"),
  59.         ]);
  60.     }
  61. }