1 | <?php |
||
19 | class CreateTicketsCommand extends ContainerAwareCommand |
||
20 | { |
||
21 | /** |
||
22 | * @var OutputInterface |
||
23 | */ |
||
24 | private $output; |
||
25 | |||
26 | protected function configure() |
||
32 | |||
33 | protected function execute(InputInterface $input, OutputInterface $output) |
||
34 | { |
||
35 | $this->output = $output; |
||
36 | /* @var \BCRM\BackendBundle\Entity\Event\EventRepository $eventRepo */ |
||
37 | /* @var \BCRM\BackendBundle\Entity\Event\RegistrationRepository $registrationRepo */ |
||
38 | $eventRepo = $this->getContainer()->get('bcrm.backend.repo.event'); |
||
39 | $registrationRepo = $this->getContainer()->get('bcrm.backend.repo.registration'); |
||
40 | $event = $eventRepo->getNextEvent()->getOrThrow(new CommandException('No event.')); |
||
41 | foreach (array(Ticket::DAY_SATURDAY, Ticket::DAY_SUNDAY) as $day) { |
||
42 | // Regular tickets |
||
43 | $capacity = $eventRepo->getCapacity($event, $day); |
||
44 | $this->logVerbose(sprintf('Capacity on day %d: %d', $day, $capacity)); |
||
45 | if ($capacity > 0) { |
||
46 | foreach ($registrationRepo->getNextRegistrations($event, $day, $capacity) as $registration) { |
||
47 | $this->createTicketForRegistration($event, $registration, $day); |
||
48 | } |
||
49 | } |
||
50 | // VIP-Tickets |
||
51 | foreach ($registrationRepo->getNextVipRegistrations($event, $day) as $registration) { |
||
52 | $this->createTicketForRegistration($event, $registration, $day); |
||
53 | } |
||
54 | } |
||
55 | } |
||
56 | |||
57 | protected function createTicketForRegistration(Event $event, Registration $registration, $day) |
||
58 | { |
||
59 | $commandBus = $this->getContainer()->get('command_bus'); |
||
60 | $this->logVerbose(sprintf('Creating day %d ticket for registration %s', $day, $registration)); |
||
61 | $command = new CreateTicketCommand(); |
||
62 | $command->registration = $registration; |
||
63 | $command->day = $day; |
||
64 | $command->event = $event; |
||
|
|||
65 | $commandBus->handle($command); |
||
66 | } |
||
67 | |||
68 | protected function logVerbose($msg) |
||
73 | } |
||
74 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..