| @@ -6,22 +6,18 @@ | ||
| 6 | 6 | |
| 7 | 7 | use UserAccessManager\Config\MainConfig; |
| 8 | 8 | use UserAccessManager\Database\Database; |
| 9 | 9 | use UserAccessManager\Object\ObjectHandler; |
| 10 | -use UserAccessManager\Util\Util; | |
| 11 | -use UserAccessManager\Wrapper\Php; | |
| 12 | 10 | use UserAccessManager\Wrapper\Wordpress; |
| 13 | 11 | |
| 14 | 12 | class UserGroupFactory |
| 15 | 13 | { |
| 16 | 14 | public function __construct( |
| 17 | - private Php $php, | |
| 18 | 15 | private Wordpress $wordpress, |
| 19 | 16 | private Database $database, |
| 20 | 17 | private MainConfig $config, |
| 21 | - private Util $util, | |
| 22 | 18 | private ObjectHandler $objectHandler, |
| 23 | - private AssignmentInformationFactory $assignmentInformationFactory | |
| 19 | + private AssignedObjectsLoader $assignedObjectsLoader | |
| 24 | 20 | ) { |
| 25 | 21 | } |
| 26 | 22 | |
| 27 | 23 | /** |
| @@ -29,15 +25,13 @@ | ||
| 29 | 25 | */ |
| 30 | 26 | public function createUserGroup(int|string|null $id = null): UserGroup |
| 31 | 27 | { |
| 32 | 28 | return new UserGroup( |
| 33 | - $this->php, | |
| 34 | 29 | $this->wordpress, |
| 35 | 30 | $this->database, |
| 36 | 31 | $this->config, |
| 37 | - $this->util, | |
| 38 | 32 | $this->objectHandler, |
| 39 | - $this->assignmentInformationFactory, | |
| 33 | + $this->assignedObjectsLoader, | |
| 40 | 34 | $id |
| 41 | 35 | ); |
| 42 | 36 | } |
| 43 | 37 | |
| @@ -43,18 +37,27 @@ | ||
| 43 | 37 | |
| 44 | 38 | /** |
| 45 | 39 | * @throws UserGroupTypeException |
| 46 | 40 | */ |
| 41 | + public function createUserGroupFromDatabaseRow(object $databaseUserGroup): UserGroup | |
| 42 | + { | |
| 43 | + $userGroup = $this->createUserGroup(); | |
| 44 | + $userGroup->assignDatabaseValues($databaseUserGroup); | |
| 45 | + | |
| 46 | + return $userGroup; | |
| 47 | + } | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * @throws UserGroupTypeException | |
| 51 | + */ | |
| 47 | 52 | public function createDynamicUserGroup(string $type, int|string $id): DynamicUserGroup |
| 48 | 53 | { |
| 49 | 54 | return new DynamicUserGroup( |
| 50 | - $this->php, | |
| 51 | 55 | $this->wordpress, |
| 52 | 56 | $this->database, |
| 53 | 57 | $this->config, |
| 54 | - $this->util, | |
| 55 | 58 | $this->objectHandler, |
| 56 | - $this->assignmentInformationFactory, | |
| 59 | + $this->assignedObjectsLoader, | |
| 57 | 60 | $type, |
| 58 | 61 | $id |
| 59 | 62 | ); |
| 60 | 63 | } |