Skip to content

Commit

Permalink
Merge pull request #11 from Mapsred/04-move-defaultstatus-to-ticketst…
Browse files Browse the repository at this point in the history
…atusmanager

Replace Ticket by TicketInterface
  • Loading branch information
AxelE authored Jun 2, 2018
2 parents 087a6d5 + 370a5e2 commit 389a54d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
8 changes: 1 addition & 7 deletions Manager/TicketManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,20 @@
namespace Maps_red\TicketingBundle\Manager;

use Doctrine\ORM\EntityManagerInterface;
use Maps_red\TicketingBundle\Model\TicketInterface;

class TicketManager extends AbstractManager
{
/** @var string $defaultStatusName */
private $defaultStatusName;

/** @var bool $enableHistory */
private $enableHistory;

/**
* TicketManager constructor.
* @param EntityManagerInterface $manager
* @param string $class
* @param string $defaultStatusName
* @param bool $enableHistory
*/
public function __construct(EntityManagerInterface $manager, string $class, string $defaultStatusName, bool $enableHistory)
public function __construct(EntityManagerInterface $manager, string $class, bool $enableHistory)
{
$this->defaultStatusName = $defaultStatusName;
$this->enableHistory = $enableHistory;
parent::__construct($manager, $class);
}
Expand Down
25 changes: 25 additions & 0 deletions Manager/TicketStatusManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@

namespace Maps_red\TicketingBundle\Manager;

use Doctrine\ORM\EntityManagerInterface;
use Maps_red\TicketingBundle\Model\TicketStatusInterface;

class TicketStatusManager extends AbstractManager
{
/** @var string $defaultStatusName */
private $defaultStatusName;

/**
* TicketStatusManager constructor.
* @param EntityManagerInterface $manager
* @param string $class
* @param string $defaultStatusName
*/
public function __construct(EntityManagerInterface $manager, string $class, string $defaultStatusName)
{
parent::__construct($manager, $class);
$this->defaultStatusName = $defaultStatusName;
}

/**
* @return TicketStatusInterface|null|object
*/
public function getDefaultStatus()
{
return $this->getRepository()->findOneBy(['name' => $this->defaultStatusName]);
}
}
4 changes: 2 additions & 2 deletions Resources/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:

Maps_red\TicketingBundle\Manager\TicketManager:
tags:
- { name: ticketing.manager, class: 'ticket', default_status_name: true, enable_history: true}
- { name: ticketing.manager, class: 'ticket', enable_history: true}

Maps_red\TicketingBundle\Manager\TicketCategoryManager:
tags:
Expand All @@ -34,7 +34,7 @@ services:

Maps_red\TicketingBundle\Manager\TicketStatusManager:
tags:
- { name: ticketing.manager, class: 'ticket_status'}
- { name: ticketing.manager, class: 'ticket_status', default_status_name: true}

Maps_red\TicketingBundle\EventSubscriber\RequestSubscriber:
autowire: true
Expand Down

0 comments on commit 389a54d

Please sign in to comment.