public static function get_by_name_bulk($tagcollid, $tags, $returnfields = 'id, name, rawname, tagcollid') {
        global $DB;

        if (empty($tags)) {
            return array();
        }

        $cleantags = self::normalize(self::normalize($tags, false)); // Format: rawname => normalised name.

        list($namesql, $params) = $DB->get_in_or_equal(array_values($cleantags));
        array_unshift($params, $tagcollid);

        $recordset = $DB->get_recordset_sql("SELECT $returnfields FROM {tag} WHERE tagcollid = ? AND name $namesql", $params);

        $result = array_fill_keys($cleantags, null);
        foreach ($recordset as $record) {
            $result[$record->name] = new static($record);
        }
        $recordset->close();
        return $result;
    }
public static function get_by_name_bulk($tagcollid, $tags, $returnfields = 'id, name, rawname, tagcollid') {
        global $DB;

        if (empty($tags)) {
            return array();
        }

        $cleantags = self::normalize(self::normalize($tags, false)); // Format: rawname => normalised name.

        list($namesql, $params) = $DB->get_in_or_equal(array_values($cleantags));
        array_unshift($params, $tagcollid);

        $recordset = $DB->get_recordset_sql("SELECT $returnfields FROM {tag} WHERE tagcollid = ? AND name $namesql", $params);

        $result = array_fill_keys($cleantags, null);
        foreach ($recordset as $record) {
            $result[$record->name] = new static($record);
        }
        $recordset->close();
        return $result;
    }
public static function get_by_name_bulk ( $ tagcollid , $ tags , $ returnfields = 'id, name, rawname, tagcollid' ) { global $ DB ; if ( empty ( $ tags ) ) { return array ( ) ; } $ cleantags = self :: normalize ( self :: normalize ( $ tags , false ) ) ; // Format: rawname => normalised name. list ( $ namesql , $ params ) = $ DB -> get_in_or_equal ( array_values ( $ cleantags ) ) ; array_unshift ( $ params , $ tagcollid ) ; $ recordset = $ DB -> get_recordset_sql ( "SELECT $returnfields FROM {tag} WHERE tagcollid = ? AND name $namesql" , $ params ) ; $ result = array_fill_keys ( $ cleantags , null ) ; foreach ( $ recordset as $ record ) { $ result [ $ record -> name ] = new static ( $ record ) ; } $ recordset -> close ( ) ; return $ result ; }
Returns the list of tag objects by tag collection id and the list of tag names

@param    int   $tagcollid
@param    array $tags array of tags to look for
@param    string $returnfields list of DB fields to return, must contain 'id', 'name' and 'rawname'
@return   array tag-indexed array of objects. No value for a key means the tag wasn't found.
Returns the list of tag objects by tag collection id and the list of tag names