public function getUpdatedResourceUserEvaluation(Path $path)
    {
        $resourceUserEvaluation = null;

        $user = $this->tokenStorage->getToken()->getUser();
        if ($user instanceof User) {
            $resourceUserEvaluation = $this->resourceEvalManager->getResourceUserEvaluation($path->getResourceNode(), $user);
            $data = $this->computeResourceUserEvaluation($path, $user);

            if ($data['score'] !== $resourceUserEvaluation->getScore() ||
                $data['scoreMax'] !== $resourceUserEvaluation->getScoreMax() ||
                $data['status'] !== $resourceUserEvaluation->getStatus()
            ) {
                $resourceUserEvaluation->setScore($data['score']);
                $resourceUserEvaluation->setScoreMax($data['scoreMax']);
                $resourceUserEvaluation->setStatus($data['status']);
                $resourceUserEvaluation->setDate(new \DateTime());
                $this->om->persist($resourceUserEvaluation);
                $this->om->flush();
            }
        }

        return $resourceUserEvaluation;
    }
public function getUpdatedResourceUserEvaluation(Path $path)
    {
        $resourceUserEvaluation = null;

        $user = $this->tokenStorage->getToken()->getUser();
        if ($user instanceof User) {
            $resourceUserEvaluation = $this->resourceEvalManager->getResourceUserEvaluation($path->getResourceNode(), $user);
            $data = $this->computeResourceUserEvaluation($path, $user);

            if ($data['score'] !== $resourceUserEvaluation->getScore() ||
                $data['scoreMax'] !== $resourceUserEvaluation->getScoreMax() ||
                $data['status'] !== $resourceUserEvaluation->getStatus()
            ) {
                $resourceUserEvaluation->setScore($data['score']);
                $resourceUserEvaluation->setScoreMax($data['scoreMax']);
                $resourceUserEvaluation->setStatus($data['status']);
                $resourceUserEvaluation->setDate(new \DateTime());
                $this->om->persist($resourceUserEvaluation);
                $this->om->flush();
            }
        }

        return $resourceUserEvaluation;
    }
public function getUpdatedResourceUserEvaluation ( Path $ path ) { $ resourceUserEvaluation = null ; $ user = $ this -> tokenStorage -> getToken ( ) -> getUser ( ) ; if ( $ user instanceof User ) { $ resourceUserEvaluation = $ this -> resourceEvalManager -> getResourceUserEvaluation ( $ path -> getResourceNode ( ) , $ user ) ; $ data = $ this -> computeResourceUserEvaluation ( $ path , $ user ) ; if ( $ data [ 'score' ] !== $ resourceUserEvaluation -> getScore ( ) || $ data [ 'scoreMax' ] !== $ resourceUserEvaluation -> getScoreMax ( ) || $ data [ 'status' ] !== $ resourceUserEvaluation -> getStatus ( ) ) { $ resourceUserEvaluation -> setScore ( $ data [ 'score' ] ) ; $ resourceUserEvaluation -> setScoreMax ( $ data [ 'scoreMax' ] ) ; $ resourceUserEvaluation -> setStatus ( $ data [ 'status' ] ) ; $ resourceUserEvaluation -> setDate ( new \ DateTime ( ) ) ; $ this -> om -> persist ( $ resourceUserEvaluation ) ; $ this -> om -> flush ( ) ; } } return $ resourceUserEvaluation ; }
Fetch resource user evaluation with up-to-date status.

@param Path $path

@return ResourceUserEvaluation
Fetch resource user evaluation with up - to - date status .