nextcloud /
circles
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | /** @var CirclesManager $circlesManager */ |
||
| 4 | |||
| 5 | use OCA\Circles\CirclesManager; |
||
| 6 | use OCA\Circles\Model\Member; |
||
| 7 | |||
| 8 | $circlesManager = \OC::$server->get(CirclesManager::class); |
||
| 9 | |||
| 10 | $circlesQueryHelper = $circlesManager->getQueryHelper(); |
||
| 11 | |||
| 12 | $qb = $circlesQueryHelper->getQueryBuilder(); |
||
| 13 | $qb->select( |
||
| 14 | 'test.id', |
||
| 15 | 'test.shared_to', |
||
| 16 | 'test.data' |
||
| 17 | ) |
||
| 18 | ->from('circles_test', 'test'); |
||
| 19 | |||
| 20 | |||
| 21 | $federatedUser = $circlesManager->getFederatedUser('test9', Member::TYPE_USER); |
||
| 22 | $circlesQueryHelper->limitToInheritedMembers('test', 'shared_to', $federatedUser, true); |
||
| 23 | $circlesQueryHelper->addCircleDetails('test', 'shared_to'); |
||
| 24 | |||
| 25 | $items = []; |
||
| 26 | $cursor = $qb->execute(); |
||
| 27 | while ($row = $cursor->fetch()) { |
||
| 28 | try { |
||
| 29 | $items[] = [ |
||
| 30 | 'id' => $row['id'], |
||
| 31 | 'data' => $row['data'], |
||
| 32 | 'circle' => $circlesQueryHelper->extractCircle($row) |
||
| 33 | ]; |
||
| 34 | } catch (Exception $e) { |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
Loading history...
|
|||
| 35 | } |
||
| 36 | } |
||
| 37 | $cursor->closeCursor(); |
||
| 38 | |||
| 39 | echo json_encode($items, JSON_PRETTY_PRINT); |
||
| 40 |