Entities/Permissions/Model/PermissionsEntityMapper.php
private function selectArray(?string $selectColumns = null, array $whereColumnsInfo = null, string $orderBy = null): array
    {
        $columns = $selectColumns ?? $this->defaultSelectColumnsString;

        $permissionsArray = []; // populate with 1 entry per permission with an array of role objects

        if(null !== $records = $this->select($columns, $whereColumnsInfo, $orderBy)) {
            $rolesTableMapper = RolesTableMapper::getInstance();
            foreach ($records as $record) {
                // either add new permission or just new role based on whether permission already exists
                if (null === $key = $this->getPermissionsArrayKeyForId($permissionsArray, (int) $record['id'])) {
                    $permissionsArray[] = [
                        'id' => (int) $record['id'],
                        'title' => $record['title'],
                        'description' => $record['description'],
                        'roles' => [$rolesTableMapper->getObjectById((int) $record['role_id'])],
                        'active' => Postgres::convertPostgresBoolToBool($record['active']),
                        'created' => new \DateTimeImmutable($record['created']),
                    ];
                } else {
                    array_push($permissionsArray[$key]['roles'], $rolesTableMapper->getObjectById((int) $record['role_id']));
                }
            }
        }

        return $permissionsArray;
    }
private function selectArray(?string $selectColumns = null, array $whereColumnsInfo = null, string $orderBy = null): array
    {
        $columns = $selectColumns ?? $this->defaultSelectColumnsString;

        $permissionsArray = []; // populate with 1 entry per permission with an array of role objects

        if(null !== $records = $this->select($columns, $whereColumnsInfo, $orderBy)) {
            $rolesTableMapper = RolesTableMapper::getInstance();
            foreach ($records as $record) {
                // either add new permission or just new role based on whether permission already exists
                if (null === $key = $this->getPermissionsArrayKeyForId($permissionsArray, (int) $record['id'])) {
                    $permissionsArray[] = [
                        'id' => (int) $record['id'],
                        'title' => $record['title'],
                        'description' => $record['description'],
                        'roles' => [$rolesTableMapper->getObjectById((int) $record['role_id'])],
                        'active' => Postgres::convertPostgresBoolToBool($record['active']),
                        'created' => new \DateTimeImmutable($record['created']),
                    ];
                } else {
                    array_push($permissionsArray[$key]['roles'], $rolesTableMapper->getObjectById((int) $record['role_id']));
                }
            }
        }

        return $permissionsArray;
    }
returns array of results instead of recordset