public function close()
    {
        $userId = 0;
        $userName = 'guest';
        $userEmail = '';

        if ($this->authenticationService) {
            if ($this->authenticationService->getIdentity() instanceof OAuth2AuthenticatedIdentity) {
                $user = $this->authenticationService->getIdentity()->getUser();

                if (method_exists($user, 'getId')) {
                    $userId = $user->getId();
                }

                if (method_exists($user, 'getDisplayName')) {
                    $userName = $user->getDisplayName();
                }

                if (method_exists($user, 'getEmail')) {
                    $userEmail = $user->getEmail();
                }
            } elseif ($this->authenticationService->getIdentity() instanceof AuthenticatedIdentity) {
                $userId = $this->authenticationService->getIdentity()->getAuthenticationIdentity()['user_id'];
                $userName = $this->authenticationService->getIdentity()->getName();
            } elseif ($this->authenticationService->getIdentity() instanceof GuestIdentity) {
            } else {
                // Is null or other identity
            }
        }

        $query = $this->getObjectManager()
            ->createNativeQuery(
                "
                SELECT close_revision_audit(:userId, :userName, :userEmail, :comment)
            ",
                new ResultSetMapping()
            )
            ->setParameter('userId', $userId)
            ->setParameter('userName', $userName)
            ->setParameter('userEmail', $userEmail)
            ->setParameter('comment', $this->revisionComment->getComment());
        ;

        $query->getResult();

        // Reset the revision comment
        $this->revisionComment->setComment('');
    }
public function close()
    {
        $userId = 0;
        $userName = 'guest';
        $userEmail = '';

        if ($this->authenticationService) {
            if ($this->authenticationService->getIdentity() instanceof OAuth2AuthenticatedIdentity) {
                $user = $this->authenticationService->getIdentity()->getUser();

                if (method_exists($user, 'getId')) {
                    $userId = $user->getId();
                }

                if (method_exists($user, 'getDisplayName')) {
                    $userName = $user->getDisplayName();
                }

                if (method_exists($user, 'getEmail')) {
                    $userEmail = $user->getEmail();
                }
            } elseif ($this->authenticationService->getIdentity() instanceof AuthenticatedIdentity) {
                $userId = $this->authenticationService->getIdentity()->getAuthenticationIdentity()['user_id'];
                $userName = $this->authenticationService->getIdentity()->getName();
            } elseif ($this->authenticationService->getIdentity() instanceof GuestIdentity) {
            } else {
                // Is null or other identity
            }
        }

        $query = $this->getObjectManager()
            ->createNativeQuery(
                "
                SELECT close_revision_audit(:userId, :userName, :userEmail, :comment)
            ",
                new ResultSetMapping()
            )
            ->setParameter('userId', $userId)
            ->setParameter('userName', $userName)
            ->setParameter('userEmail', $userEmail)
            ->setParameter('comment', $this->revisionComment->getComment());
        ;

        $query->getResult();

        // Reset the revision comment
        $this->revisionComment->setComment('');
    }
public function close ( ) { $ userId = 0 ; $ userName = 'guest' ; $ userEmail = '' ; if ( $ this -> authenticationService ) { if ( $ this -> authenticationService -> getIdentity ( ) instanceof OAuth2AuthenticatedIdentity ) { $ user = $ this -> authenticationService -> getIdentity ( ) -> getUser ( ) ; if ( method_exists ( $ user , 'getId' ) ) { $ userId = $ user -> getId ( ) ; } if ( method_exists ( $ user , 'getDisplayName' ) ) { $ userName = $ user -> getDisplayName ( ) ; } if ( method_exists ( $ user , 'getEmail' ) ) { $ userEmail = $ user -> getEmail ( ) ; } } elseif ( $ this -> authenticationService -> getIdentity ( ) instanceof AuthenticatedIdentity ) { $ userId = $ this -> authenticationService -> getIdentity ( ) -> getAuthenticationIdentity ( ) [ 'user_id' ] ; $ userName = $ this -> authenticationService -> getIdentity ( ) -> getName ( ) ; } elseif ( $ this -> authenticationService -> getIdentity ( ) instanceof GuestIdentity ) { } else { // Is null or other identity } } $ query = $ this -> getObjectManager ( ) -> createNativeQuery ( "
                SELECT close_revision_audit(:userId, :userName, :userEmail, :comment)
            " , new ResultSetMapping ( ) ) -> setParameter ( 'userId' , $ userId ) -> setParameter ( 'userName' , $ userName ) -> setParameter ( 'userEmail' , $ userEmail ) -> setParameter ( 'comment' , $ this -> revisionComment -> getComment ( ) ) ; ; $ query -> getResult ( ) ; // Reset the revision comment $ this -> revisionComment -> setComment ( '' ) ; }
Close a revision - can be done manually or automatically via postFlush
Close a revision - can be done manually or automatically via postFlush