Wylogowałem sobie jaką wartość dostaję i mam INTEGER 0 (zero) .
Nie wiem czemu kod nie wchodzi w tego elseif-a pierwszego , tylko w tego drugiego.
Będę wdzięczny za podpowiedź.
services.yaml
App\EventListener\ResultListener: tags: - { name: doctrine.event_listener, event: postUpdate }
ResultListener
class ResultListener { ... public function postUpdate(LifecycleEventArgs $args) { $entity = $args->getEntity(); $em = $args->getEntityManager(); if ($entity instanceof Meet) { $meetId = $entity->getId(); $typeRepo = $em->getRepository(Type::class); $types = $typeRepo->findByMeet($meetId); foreach ($types as $type) { ... elseif ( // typ1 == typ2 i wynik1 == wynik2 i typ1 <> wynik1 ($type->getHostType() == $type->getGuestType()) && ($entity->getHostGoals() == $entity->getGuestGoals()) && ($type->getHostType() <> $entity->getHostGoals()) && ) { $this->logger->info('Update set 2 points (option 3)'); $type->setNumberOfPoints(2); } elseif ( ) { $this->logger->info('@@@@@@@@@@ $entity->getHostGoals(): ' . $entity->getHostGoals()); $this->logger->info('@@@@@@@@@@ $entity->getGuestGoals(): ' . $entity->getGuestGoals()); $this->logger->info('@@@@@@@@@@ empty($entity->getHostGoals()): ' . empty($entity->getHostGoals())); $this->logger->info('@@@@@@@@@@ empty($entity->getGuestGoals()): ' . empty($entity->getGuestGoals())); $this->logger->info('@@@@@@@@@@ gettype($entity->getHostGoals()): ' . gettype($entity->getHostGoals())); $this->logger->info('@@@@@@@@@@ NO UPDATE!'); } ...
co to dostaję w logach:
[2022-11-26 12:45:02] app.INFO: @@@@@@@@@@ $entity->getHostGoals(): 0 [] []
[2022-11-26 12:45:02] app.INFO: @@@@@@@@@@ $entity->getGuestGoals(): 0 [] []
[2022-11-26 12:45:02] app.INFO: @@@@@@@@@@ empty($entity->getHostGoals()): 1 [] []
[2022-11-26 12:45:02] app.INFO: @@@@@@@@@@ empty($entity->getGuestGoals()): 1 [] []
[2022-11-26 12:45:02] app.INFO: @@@@@@@@@@ gettype($entity->getHostGoals()): integer [] []
[2022-11-26 12:45:02] app.INFO: @@@@@@@@@@ NO UPDATE! [] []