PhpBench\Extensions\Dbal\Storage\Driver\Dbal\Repository::getGroups PHP Method

getGroups() public method

public getGroups ( $subjectId )
    public function getGroups($subjectId)
    {
        $sql = <<<'EOT'
SELECT 
    sgroup
    FROM sgroup_subject
    WHERE sgroup_subject.subject_id = ?
EOT;
        $conn = $this->manager->getConnection();
        $stmt = $conn->prepare($sql);
        $stmt->execute([$subjectId]);
        $groups = array_map(function ($value) {
            return $value[0];
        }, $stmt->fetchAll(\PDO::FETCH_NUM));
        return $groups;
    }

Usage Example

Beispiel #1
0
 private function getSubject(\ArrayObject $context, Benchmark $benchmark, $row)
 {
     $key = $row['run.uuid'] . $row['subject.benchmark'] . $row['subject.name'];
     if (isset($context[self::SUBJECTS][$key])) {
         return $context[self::SUBJECTS][$key];
     }
     $subject = $benchmark->createSubject($row['subject.name']);
     $subject->setSleep($row['variant.sleep']);
     $subject->setOutputTimeUnit($row['variant.output_time_unit']);
     $subject->setOutputTimePrecision($row['variant.output_time_precision']);
     $subject->setOutputMode($row['variant.output_mode']);
     $context[self::SUBJECTS][$key] = $subject;
     $groups = $this->repository->getGroups($row['subject.id']);
     $subject->setGroups($groups);
     return $subject;
 }