# user-access-manager/trunk/src/Setup/Update/DatabaseUpdate5.php

User Access Manager, version trunk. 45 lines.

- Page: https://pluginprobe.com/plugins/user-access-manager/trunk/code/src/Setup/Update/DatabaseUpdate5.php
- Raw: https://pluginprobe.com/plugins/user-access-manager/trunk/raw/src/Setup/Update/DatabaseUpdate5.php
- Modified: 2026-09-10T09:55:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/user-access-manager/trunk/code/src/Setup/Update/DatabaseUpdate5.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace UserAccessManager\Setup\Update;

use Exception;

class DatabaseUpdate5 extends DatabaseUpdate
{
    public function getVersion(): string
    {
        return '1.5.1';
    }

    /**
     * @throws Exception
     */
    public function update(): bool
    {
        $dbAccessGroupToObject = $this->database->getUserGroupToObjectTable();
        $query = "SELECT `object_id` AS `objectId`, `object_type` AS `objectType`, `group_id` AS `groupId`
            FROM `{$dbAccessGroupToObject}`
            WHERE `general_object_type` = ''";

        $dbObjects = (array) $this->database->getResults($query);
        $success = true;

        foreach ($dbObjects as $dbObject) {
            $update = $this->database->update(
                $dbAccessGroupToObject,
                ['general_object_type' => $this->objectHandler->getGeneralObjectType($dbObject->objectType)],
                [
                    'object_id' => $dbObject->objectId,
                    'group_id' => $dbObject->groupId,
                    'object_type' => $dbObject->objectType
                ]
            );
            $success = $success && ($update !== false);
        }

        return $success;
    }
}

```
