public function isCurrentUserOwner(Transaction $transaction)
    {
        if($this->securityContext->getToken()->getUser()->isGranted('ROLE_ADMIN')){
            return true;
        }
        
        $currentUserId = $this->securityContext->getToken()->getUser()->getId();
        //actor owner
        if($transaction->getActor() instanceof Actor){
            if($currentUserId ==  $transaction->getActor()->getId()){
                return true;
            }elseif($currentUserId == $transaction->getItems()->first()->getProduct()->getActor()->getId()){
                return true;
            }
        }
        
        return false;
    }
public function isCurrentUserOwner(Transaction $transaction)
    {
        if($this->securityContext->getToken()->getUser()->isGranted('ROLE_ADMIN')){
            return true;
        }
        
        $currentUserId = $this->securityContext->getToken()->getUser()->getId();
        //actor owner
        if($transaction->getActor() instanceof Actor){
            if($currentUserId ==  $transaction->getActor()->getId()){
                return true;
            }elseif($currentUserId == $transaction->getItems()->first()->getProduct()->getActor()->getId()){
                return true;
            }
        }
        
        return false;
    }
public function isCurrentUserOwner ( Transaction $ transaction ) { if ( $ this -> securityContext -> getToken ( ) -> getUser ( ) -> isGranted ( 'ROLE_ADMIN' ) ) { return true ; } $ currentUserId = $ this -> securityContext -> getToken ( ) -> getUser ( ) -> getId ( ) ; //actor owner if ( $ transaction -> getActor ( ) instanceof Actor ) { if ( $ currentUserId == $ transaction -> getActor ( ) -> getId ( ) ) { return true ; } elseif ( $ currentUserId == $ transaction -> getItems ( ) -> first ( ) -> getProduct ( ) -> getActor ( ) -> getId ( ) ) { return true ; } } return false ; }
Check if current user is the transaction owner

@param Transaction $transaction

@return boolean
Check if current user is the transaction owner