public function isInstantWinner($game, $user, $value = null)
    {
        $occurrenceMapper = $this->getInstantWinOccurrenceMapper();

        if ($game->getOccurrenceType()=='datetime') {
            $entry = $this->findLastActiveEntry($game, $user);

            // si date après date de gain et date de gain encore active alors desactive date de gain, et winner !
            $occurrence = $occurrenceMapper->checkDateOccurrenceByGameId($game);
        } elseif ($game->getOccurrenceType()=='code') {
            $occurrence = $occurrenceMapper->checkCodeOccurrenceByGameId($game, $value);
            if (!$occurrence) {
                return false;
            }
            $entry = $this->play($game, $user);
        }

        if (!$entry) {
            return false;
        }
        $this->getEventManager()->trigger(
            __FUNCTION__ . '.pre',
            $this,
            array('user' => $user, 'game' => $game, 'entry' => $entry)
        );
        $occurrence = $this->setOccurrenceEntry($game, $user, $entry, $occurrence);
        $this->getEventManager()->trigger(
            __FUNCTION__ . '.post',
            $this,
            array('user' => $user, 'game' => $game, 'entry' => $entry, 'occurrence' => $occurrence)
        );
        return $occurrence;
    }
public function isInstantWinner($game, $user, $value = null)
    {
        $occurrenceMapper = $this->getInstantWinOccurrenceMapper();

        if ($game->getOccurrenceType()=='datetime') {
            $entry = $this->findLastActiveEntry($game, $user);

            // si date après date de gain et date de gain encore active alors desactive date de gain, et winner !
            $occurrence = $occurrenceMapper->checkDateOccurrenceByGameId($game);
        } elseif ($game->getOccurrenceType()=='code') {
            $occurrence = $occurrenceMapper->checkCodeOccurrenceByGameId($game, $value);
            if (!$occurrence) {
                return false;
            }
            $entry = $this->play($game, $user);
        }

        if (!$entry) {
            return false;
        }
        $this->getEventManager()->trigger(
            __FUNCTION__ . '.pre',
            $this,
            array('user' => $user, 'game' => $game, 'entry' => $entry)
        );
        $occurrence = $this->setOccurrenceEntry($game, $user, $entry, $occurrence);
        $this->getEventManager()->trigger(
            __FUNCTION__ . '.post',
            $this,
            array('user' => $user, 'game' => $game, 'entry' => $entry, 'occurrence' => $occurrence)
        );
        return $occurrence;
    }
public function isInstantWinner ( $ game , $ user , $ value = null ) { $ occurrenceMapper = $ this -> getInstantWinOccurrenceMapper ( ) ; if ( $ game -> getOccurrenceType ( ) == 'datetime' ) { $ entry = $ this -> findLastActiveEntry ( $ game , $ user ) ; // si date après date de gain et date de gain encore active alors desactive date de gain, et winner ! $ occurrence = $ occurrenceMapper -> checkDateOccurrenceByGameId ( $ game ) ; } elseif ( $ game -> getOccurrenceType ( ) == 'code' ) { $ occurrence = $ occurrenceMapper -> checkCodeOccurrenceByGameId ( $ game , $ value ) ; if ( ! $ occurrence ) { return false ; } $ entry = $ this -> play ( $ game , $ user ) ; } if ( ! $ entry ) { return false ; } $ this -> getEventManager ( ) -> trigger ( __FUNCTION__ . '.pre' , $ this , array ( 'user' => $ user , 'game' => $ game , 'entry' => $ entry ) ) ; $ occurrence = $ this -> setOccurrenceEntry ( $ game , $ user , $ entry , $ occurrence ) ; $ this -> getEventManager ( ) -> trigger ( __FUNCTION__ . '.post' , $ this , array ( 'user' => $ user , 'game' => $ game , 'entry' => $ entry , 'occurrence' => $ occurrence ) ) ; return $ occurrence ; }
return true if the player has won. False otherwise.

@param \PlaygroundGame\Entity\Game $game
@param \PlaygroundUser\Entity\UserInterface $user

@return boolean
return true if the player has won . False otherwise .