Browse Source

Merge branch 'develop'

master
Guillaume 4 years ago
parent
commit
ca5bc58a08
3 changed files with 20 additions and 4 deletions
  1. +4
    -2
      ShopBundle/Controller/Backend/MerchantController.php
  2. +15
    -1
      ShopBundle/Repository/TicketRepository.php
  3. +1
    -1
      ShopBundle/Twig/BackendTwigExtension.php

+ 4
- 2
ShopBundle/Controller/Backend/MerchantController.php View File

->find($idMerchant); ->find($idMerchant);


if ($merchant) { if ($merchant) {

$user->setMerchant($merchant); $user->setMerchant($merchant);
$em->persist($user); $em->persist($user);
$em->flush(); $em->flush();

return $this->redirect($merchant->getMerchantConfig('url').'admin/dashboard') ;
} }
} }
return $this->redirect('/admin/dashboard') ;

return $this->redirectToRoute('admin_dashboard') ;
} }


} }

+ 15
- 1
ShopBundle/Repository/TicketRepository.php View File

return TicketInterface::class; return TicketInterface::class;
} }


public function filterStatus($query, $statusArray)
{
$query->andWhere('e.status IN (:status)')->setParameter('status', $statusArray) ;
return $query ;
}

public function findAllOpen() public function findAllOpen()
{ {
$query = $this->findByMerchantQuery() ; $query = $this->findByMerchantQuery() ;
$query->andWhere('e.status IN (:statusOpen)')->setParameter('statusOpen', [Ticket::TICKET_STATUS_OPEN, Ticket::TICKET_STATUS_BEING_PROCESSED]) ;
$this->filterStatus($query, [Ticket::TICKET_STATUS_OPEN, Ticket::TICKET_STATUS_BEING_PROCESSED]) ;
$query->addOrderBy('e.id', 'DESC') ; $query->addOrderBy('e.id', 'DESC') ;
return $query->getQuery()->getResult() ; return $query->getQuery()->getResult() ;
} }

public function countAllOpen()
{
$query = $this->findByMerchantQuery() ;
$query->select('count(e.id)');
$this->filterStatus($query, [Ticket::TICKET_STATUS_OPEN, Ticket::TICKET_STATUS_BEING_PROCESSED]) ;
return $query->getQuery()->getSingleScalarResult() ;
}
} }



+ 1
- 1
ShopBundle/Twig/BackendTwigExtension.php View File

switch($entityName){ switch($entityName){
case 'ticket' : case 'ticket' :
$ticketRepo = $this->em->getRepository(TicketInterface::class); $ticketRepo = $this->em->getRepository(TicketInterface::class);
return $ticketRepo->countByStatus('open');
return $ticketRepo->countAllOpen();


} }
} }

Loading…
Cancel
Save