Lines
n/a
0 / 0
Methods
n/a
0 / 0
Classes
n/a
0 / 0
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| init | n/a | 0 / 0 | n/a | 0 / 0 | 4 | ||
| 8 | class LogoutWorkstations | |
| 9 | { | |
| 10 | /** | |
| 11 | * logout all workstations | |
| 12 | * | |
| 13 | * @return void | |
| 14 | */ | |
| 15 | ||
| 16 | public static function init(bool $verbose): void | |
| 17 | { | |
| 18 | $query = new \BO\Zmsbackend\Workstation\Repository\Workstation(\BO\Zmsbackend\Query\Base::SELECT); | |
| 19 | $query | |
| 20 | ->addEntityMapping() | |
| 21 | ->addResolvedReferences(1); | |
| 22 | $parameters = $query->getParameters(); | |
| 23 | $connection = \BO\Zmsbackend\Connection\Select::getWriteConnection(); | |
| 24 | $statement = $connection->prepare("$query"); | |
| 25 | $statement->execute($parameters); | |
| 26 | while ($data = $statement->fetch(\PDO::FETCH_ASSOC)) { | |
| 27 | $dataEntity = new \BO\Zmsentities\Workstation(); | |
| 28 | $dataEntity->exchangeArray($query->postProcessJoins($data)); | |
| 29 | $dataEntity->setResolveLevel($query->getResolveLevel()); | |
| 30 | if ($dataEntity->useraccount->lastLogin) { | |
| 31 | if ($verbose) { | |
| 32 | \App::$log->info('Workstation logout', [ | |
| 33 | 'workstationId' => $dataEntity->id, | |
| 34 | 'useraccountId' => $dataEntity->useraccount->id, | |
| 35 | ]); | |
| 36 | } | |
| 37 | (new \BO\Zmsbackend\Workstation\Service\Workstation())->writeEntityLogoutByName($dataEntity->useraccount->id); | |
| 38 | } | |
| 39 | } | |
| 40 | \BO\Zmsbackend\Connection\Select::writeCommit(); | |
| 41 | } | |
| 42 | } |