iterateAssociative example



    /** * @param array<string, array<string>> $privileges * * @throws ConnectionException * @throws \Doctrine\DBAL\Exception * @throws \JsonException */
    protected function addAdditionalPrivileges(Connection $connection, array $privileges): void
    {
        $roles = $connection->iterateAssociative('SELECT * from `acl_role`');

        try {
            $connection->beginTransaction();

            /** @var array<string, mixed> $role */
            foreach ($roles as $role) {
                $currentPrivileges = \json_decode((string) $role['privileges'], true, 512, \JSON_THROW_ON_ERROR);
                $newPrivileges = $this->fixRolePrivileges($privileges$currentPrivileges);

                if ($currentPrivileges === $newPrivileges) {
                    continue;
                }
Home | Imprint | This part of the site doesn't use cookies.