Returns groups by their names.

@param array $names

@return array[Group]

@throws MissingObjectException if one or more groups cannot be found
961737
public function findGroupsByNames(array $names)
    {
        $nameCount = count($names);
        $dql = '
            SELECT g FROM Claroline\CoreBundle\Entity\Group g
            WHERE g.name IN (:names)
        ';

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

        $result = $query->getResult();

        if (($groupCount = count($result)) !== $nameCount) {
            throw new MissingObjectException("{$groupCount} out of {$nameCount} groups were found");
        }

        return $result;
    }
514847
public function findEnabledResourceTypesByNames(array $names)
    {
        if (count($names) > 0) {
            $dql = '
                SELECT r
                FROM Claroline\CoreBundle\Entity\Resource\ResourceType r
                WHERE r.isEnabled = true
                AND r.name IN (:names)
            ';

            $query = $this->_em->createQuery($dql);
            $query->setParameter('names', $names);
            $result = $query->getResult();
        } else {
            $result = [];
        }

        return $result;
    }
142132
private function getGroupIdByName(string $name)
    {
        if (!isset($this->groups)) {
            $this->resetCraftFieldsServiceGroupsCache();

            $this->groups = [];
            foreach (Craft::$app->fields->getAllGroups() as $group) {
                $this->groups[$group->name] = $group->id;
            }
        }
        if (!array_key_exists($name, $this->groups)) {
            $group = new FieldGroup(['name' => $name]);
            if (Craft::$app->fields->saveGroup($group)) {
                $this->groups[$name] = $group->id;
            } else {
                return Schematic::importError($group, $name);
            }
        }

        return $this->groups[$name];
    }
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;
    }
132199
public function setNames($names)
    {
        foreach ($this->columns as $key => $column) {
            Arr::set($names, $key, $column->getSingular());
        }

        return $names;
    }
676515
public function getGroup($name) {
		$names = explode("/", $name);
		
		$parent = $this;
		foreach ($names as $tmpName) {
			if (!isset($parent->subGroups[$tmpName])) {
				$newGroup = new MoufGroupDescriptor();
				$parent->subGroups[$tmpName] = $newGroup;
				$parent = $newGroup;
			} else {
				$parent = $parent->subGroups[$tmpName];
			}
		}
		return $parent;
	}
323560
protected function checkGroups(array $groups)
    {
        $checkedGroups = array();
        foreach ($groups as $group) {
            if (true === is_string($group) && false === in_array($group, $checkedGroups)) {
                $checkedGroups[] = (string)$group;
            }
        }
        return $checkedGroups;
    }
800569
private function setObjectForCollectionData(array $data)
    {
        $objects = [];
        foreach ($data as $attribute => $object) {
            if (is_array($object) === false) {
                throw new MissingIdentifierAttribute();
            }

            $objects[$attribute] = $this->setObject($object);
        }

        return $objects;
    }
1186750
public function getKeysByName($names)
    {
        if (empty($names)) {
            return [];
        }

        return $this->whereIn('name', $names)
                    ->select($this->getKeyName())->get()
                    ->pluck($this->getKeyName())->all();
    }
590365
protected function getRoleIdsFromNames(array $names)
    {
        $key = Models::role()->getKeyName();

        return Models::role()
                     ->whereIn('name', $names)
                     ->get([$key])
                     ->pluck($key);
    }
572415
public function getGroups()
    {
        return $this->apiCall('groups.list')->then(function ($response) {
            $groups = [];
            foreach ($response['groups'] as $group) {
                $groups[] = new Group($this, $group);
            }
            return $groups;
        });
    }
1020320
public function getItemsPermissions($names)
    {
        $permissions = array();

        $items = $this->getPermissions();
        $flat = $this->flattenPermissions($items);

        foreach ($flat as $itemName => $item) {
            if (in_array($itemName, $names)) {
                $permissions[$itemName] = $item;
            }
        }

        return $permissions;
    }
1132144
public function getAssociatedByName($names)
    {
        $return = [];

        $table = $this->_table();
        foreach ($names as $association) {
            $associationClass = $table->associations()->get($association);
            if (!$associationClass) {
                throw new RuntimeException(sprintf(
                    'Table "%s" is not associated with "%s"',
                    get_class($table),
                    $association
                ));
            }
            $return[$associationClass->getName()] = $associationClass;
        }

        return $return;
    }
1091615
public function findActiveByGroups(array $groups, array $options = [])
    {
        if (empty($groups)) {
            return null;
        }

        /** @var $adapter UserModel */
        if (null === $adapter = $this->framework->getAdapter(UserModel::class)) {
            return null;
        }

        $t = $adapter->getTable();
        $time = \Date::floorToMinute();
        $values = [];

        $columns = ["($t.start='' OR $t.start<='$time') AND ($t.stop='' OR $t.stop>'".($time + 60)."') AND $t.disable=''"];

        if (!empty(array_filter($groups))) {
            list($tmpColumns, $tmpValues) = System::getContainer()->get('huh.utils.database')->createWhereForSerializedBlob('groups', array_filter($groups));

            $columns[] = str_replace('?', $tmpValues[0], $tmpColumns);
        }

        return $adapter->findBy($columns, $values, $options);
    }
1304504
public function findByKeys(array $keys)
    {
        $result = [];
        /** @var Cursor $list */
        $list = $this->collection->find(['_id' => ['$in' => $keys]]);

        foreach ($list as $document) {
            $result[] = $this->hydrateEntity($document);
        }

        return $result;
    }
316093
public function getGroups()
	{
		if (!is_array($this->_xml))
		{

			return false;
		}

		$results = array();
		foreach ($this->_xml as $name => $group)
		{
			$results[$name] = $this->getNumParams($name);
		}

		return $results;
	}
686604
public function findByIds($class, array $ids)
    {
        if (count($ids) === 0) {
            return array();
        }

        $dql = "SELECT object FROM {$class} object WHERE object.id IN (:ids)";
        $query = $this->wrapped->createQuery($dql);
        $query->setParameter('ids', $ids);
        $objects = $query->getResult();

        if (($entityCount = count($objects)) !== ($idCount = count($ids))) {
            throw new MissingObjectException(
                "{$entityCount} out of {$idCount} ids don't match any existing object"
            );
        }

        return $objects;
    }