Skip to content

Commit 7c09672

Browse files
authored
do not initialize memberStorageId in UserManager::constructor (#205)
1 parent b24f6e8 commit 7c09672

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

UPGRADE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Upgrade Notes
2+
### 5.0.3
3+
- **[BUGFIX]**: Do not initialize `memberStorageId` in UserManager::constructor to prevent early db connection
24

35
### 5.0.2
46
- **[IMPROVEMENT]**: RoleOptionsProvider now shows the default role in UserGroup objects if no configuration was made [#201](https://github.com/dachcom-digital/pimcore-members/issues/201)

src/Manager/UserManager.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,11 @@ class UserManager implements UserManagerInterface
1111
{
1212
protected Configuration $configuration;
1313
protected ClassManagerInterface $classManager;
14-
protected int $memberStorageId;
1514

1615
public function __construct(Configuration $configuration, ClassManagerInterface $classManager)
1716
{
1817
$this->configuration = $configuration;
1918
$this->classManager = $classManager;
20-
21-
$storagePath = $configuration->getConfig('storage_path');
22-
if (($membersStoreObject = DataObject::getByPath($storagePath)) instanceof DataObject\Folder) {
23-
$this->memberStorageId = $membersStoreObject->getId();
24-
}
2519
}
2620

2721
public function getClass(): string
@@ -187,10 +181,16 @@ public function updateUser(UserInterface $user, array $properties = []): UserInt
187181

188182
private function setupNewUser(UserInterface $user, ?string $key): UserInterface
189183
{
184+
$memberStorageId = null;
190185
$validKey = $key ?? $user->getEmail();
191186

187+
$storagePath = $this->configuration->getConfig('storage_path');
188+
if (($membersStoreObject = DataObject::getByPath($storagePath)) instanceof DataObject\Folder) {
189+
$memberStorageId = $membersStoreObject->getId();
190+
}
191+
192192
$user->setKey(\Pimcore\File::getValidFilename($validKey));
193-
$user->setParentId($this->memberStorageId);
193+
$user->setParentId($memberStorageId);
194194

195195
$userGroups = [];
196196
$userConfiguration = $this->configuration->getConfig('user');

0 commit comments

Comments
 (0)