<commit_before><?php

namespace CAD\Bundle\HushBundle\Helpers;

use \Doctrine\ORM\EntityManager;
use \CAD\Bundle\HushBundle\Entity\Users;

class RelationshipChecker{
    protected $em;

    public function __construct(EntityManager $em){
        $this->em = $em;
    }

    public function inRelationship(Users $user1, Users $user2){
        if($user1->getId() == $user2->getId()){
            return false;
        }

        $check_query = $this->em->createQuery('SELECT rel from HushBundle:UserRelationship rel WHERE :user1 MEMBER OF rel.users AND :user2 MEMBER OF rel.users');
        $check_query->setParameter('user1', $user1);
        $check_query->setParameter('user2', $user2);
        $entities = $check_query->getResult();

        if(empty($entities)){
            return false;
        }

        return true;
    }
}<commit_msg>Added getRelationships function for two users<commit_after><?php

namespace CAD\Bundle\HushBundle\Helpers;

use \Doctrine\ORM\EntityManager;
use \CAD\Bundle\HushBundle\Entity\Users;

class RelationshipChecker{
    protected $em;

    public function __construct(EntityManager $em){
        $this->em = $em;
    }

    public function getRelationships(Users $user1, Users $user2){
        if($user1->getId() == $user2->getId()){
            return false;
        }

        $check_query = $this->em->createQuery('SELECT rel from HushBundle:UserRelationship rel WHERE :user1 MEMBER OF rel.users AND :user2 MEMBER OF rel.users');
        $check_query->setParameter('user1', $user1);
        $check_query->setParameter('user2', $user2);
        $entities = $check_query->getResult();

        return $entities;
    }

    public function inRelationship(Users $user1, Users $user2){
        $entities = $this->getRelationships($user1, $user2);

        if(empty($entities)){
            return false;
        }

        return true;
    }
}
{'fraction_non_alphanumeric': 0.12999467234949388, 'fraction_numerical': 0.012786361214704315, 'mean_word_length': 2.9453781512605044, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7318047', 'n_tokens_mistral': 573, 'n_tokens_neox': 566, 'n_words': 124}