Fetch group entity based on role name

@param  string $name Role name
@return \Cake\Datasource\EntityInterface|null
10036
protected function getGroupByRoleName(string $name) : ?EntityInterface
    {
        $result = TableRegistry::get('Groups.Groups')->find()
            ->enableHydration(true)
            ->where(['name' => $name])
            ->first();

        Assert::nullOrIsInstanceOf($result, EntityInterface::class);

        return $result;
    }
75702
public function getHasOneByRelationName($name)
    {
        if ($table = $this->getReferencingTable($name)) {
            if ($model = static::getModelFromTable($table)) {
                $refField = $this->getReferencingField($table, $name);

                return $this->hasOne($model, $refField);
            }
        }

        return null;
    }
1232705
public function getRepository($name = null)
    {
        if (is_null($name) || empty($name)) {
            $manager_class = get_class($this);
            $name = str_replace(array('\\Manager\\', 'Manager', '\\'), array(':', '', ''), $manager_class);
            $name = str_replace(
                array('\\Manager\\', '\\Bundle\\', 'Manager', '\\'),
                array(':', '', ''),
                $manager_class
            );
        }

        return $this->container->get('doctrine.orm.entity_manager')->getRepository($name);
    }
245595
public function getAffinityGroupProperties($name)
    {
        Validate::isString($name, 'name');
        Validate::notNullOrEmpty($name, 'name');

        $context = new HttpCallContext();
        $context->setMethod(Resources::HTTP_GET);
        $context->setPath($this->_getAffinityGroupPath($name));
        $context->addStatusCode(Resources::STATUS_OK);

        $response = $this->sendHttpContext($context);
        $parsed = $this->dataSerializer->unserialize($response->getBody());

        return GetAffinityGroupPropertiesResult::create($parsed);
    }
1359479
public function &getEntityByFullyQualifiedName($name)
    {
        if (!isset( $this->entities[$name] )) {
            throw new \RuntimeException( 'An entity by the name of ' . $name . ' could not be located.' );
        }

        return $this->entities[$name];
    }
381199
public function get(string $name)
    {
        return isset(self::$services[$name]) ? self::$services[$name] : null;
    }
1363871
public function get($name) {
        $query = $this->queryAll();
        return isset($query[$name]) ? $query[$name] : null;
    }
625448
public function getSectionByName($name)
    {
        foreach ($this->sections as $i => $sec) {
            if ($sec instanceof Section) {
                if ($sec->getName() == $name) {
                    return $sec;
                }
            }
        }
        return null;
    }
719983
public function getAggregation($name)
    {
        if ($this->aggregations && $this->aggregations->has($name)) {
            return $this->aggregations->get($name);
        } else {
            return null;
        }
    }
382703
public function getGroup($groupName)
    {
        return isset($this->groups[$groupName]) ? $this->groups[$groupName] : null;
    }
775425
public function getAggregation($name)
    {
        if (isset($this->aggregations[$name])) {
            return $this->aggregations[$name];
        }
        return null;
    }
557573
public function get($name) {
        return isset($this->metadata[$name]) ? $this->metadata[$name] : null;
    }
480720
public function getRepository($name = null)
    {
        $doctrine = $this->getDoctrine();

        if ($name) {
            return $doctrine->getRepository($name);
        }

        return $doctrine->getRepository($this->getClass());
    }
103747
public function getRepository($name)
    {
        return array_key_exists($name, $this->repositoryList) ? $this->repositoryList[$name] : null;
    }
308944
public function findGroupByName($name, $executeQuery = true)
    {
        $dql = '
            SELECT g
            FROM Claroline\CoreBundle\Entity\Group g
            WHERE g.name = :name
        ';

        $query = $this->_em->createQuery($dql);
        $query->setParameter('name', $name);

        return $executeQuery ? $query->getOneOrNullResult() : $query;
    }
651173
public function getDisplayGroup($name)
    {
        if ($group = parent::getDisplayGroup($name)) {
            return $group;
        } else {
            $subforms = $this->getSubForms();
            foreach($subforms as $subform) {
                if ($group = $subform->getDisplayGroup($name)) {
                    return $group;
                }
            }
            return;
        }
    }
48659
private function getSiteGroup($name)
   {
      $query = (new Query())
         ->select(['id', 'name'])
         ->from(['{{%sitegroups}}'])
         ->orderBy(['name' => SORT_DESC])
         ->where(['name' => $name]);
      
      $result = $query->one();
      
      if ($result){
         $group = new SiteGroup();
         $group->id = $result['id'];
         $group->name = $result['name'];
         return $group;
         
         
      } else {
         return false;
      }
   }