Skip to content

Commit b110ed0

Browse files
committed
generic collections/repositories (ref #333)
1 parent 7524cee commit b110ed0

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

Infrastructure/Console/Command/SynchronizeUsernamesCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6767
$this->repository->delete($unknownUsername);
6868
}
6969

70-
$rows[] = 'Deleted username <info>'.$unknownUsername.'</info> from user <info>'.$unknownUsername->getUser()->getId()->toString().'</info>';
70+
$rows[] = 'Deleted username <info>'.$unknownUsername->toString().'</info> from user <info>'.$unknownUsername->getUser()->getId()->toString().'</info>';
7171
++$deleted;
7272
}
7373

Infrastructure/Doctrine/Repository/UsernameRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(string $class, EntityManagerInterface $em, UsernameL
3434

3535
public function lookup(): DomainCollection
3636
{
37-
return new GenericDomainCollection($this->lookup->lookup());
37+
return GenericDomainCollection::fromValue($this->lookup->lookup());
3838
}
3939

4040
public function findAll(int $offset = 0, int $limit = 0): DomainCollection

Model/EmailsField.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
*/
1414
trait EmailsField
1515
{
16-
/** @var iterable<UserEmail> */
16+
/** @var iterable<array-key, UserEmail> */
1717
private $emails = [];
1818

1919
/**
20-
* @return DomainCollection<UserEmail>
20+
* @return DomainCollection<array-key, UserEmail>
2121
*/
2222
public function getEmails(): DomainCollection
2323
{
24-
return new GenericDomainCollection($this->emails);
24+
return GenericDomainCollection::fromValue($this->emails);
2525
}
2626
}

Model/RolesField.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
*/
1414
trait RolesField
1515
{
16-
/** @var iterable<UserRole> */
16+
/** @var iterable<array-key, UserRole> */
1717
private $roles = [];
1818

1919
/**
20-
* @return DomainCollection<UserRole>
20+
* @return DomainCollection<array-key, UserRole>
2121
*/
2222
public function getRoles(): DomainCollection
2323
{
24-
return new GenericDomainCollection($this->roles);
24+
return GenericDomainCollection::fromValue($this->roles);
2525
}
2626
}

Repository/RoleRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
interface RoleRepository
1414
{
1515
/**
16-
* @return DomainCollection<Role>
16+
* @return DomainCollection<array-key, Role>
1717
*/
1818
public function findAll(int $offset = 0, int $limit = 0): DomainCollection;
1919

Repository/UserEmailRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
interface UserEmailRepository
1515
{
1616
/**
17-
* @return DomainCollection<UserEmail>
17+
* @return DomainCollection<array-key, UserEmail>
1818
*/
1919
public function findAllByUserId(UserId $userId, int $offset = 0, int $limit = 0): DomainCollection;
2020

Repository/UserRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
interface UserRepository
1515
{
1616
/**
17-
* @return DomainCollection<User>
17+
* @return DomainCollection<array-key, User>
1818
*/
1919
public function findAll(int $offset = 0, int $limit = 0): DomainCollection;
2020

Repository/UserRoleRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
interface UserRoleRepository
1515
{
1616
/**
17-
* @return DomainCollection<UserRole>
17+
* @return DomainCollection<array-key, UserRole>
1818
*/
1919
public function findAllByUserId(UserId $userId, int $offset = 0, int $limit = 0): DomainCollection;
2020

Repository/UsernameRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
interface UsernameRepository
1414
{
1515
/**
16-
* @return DomainCollection<Username>
16+
* @return DomainCollection<array-key, Username>
1717
*/
1818
public function lookup(): DomainCollection;
1919

2020
/**
21-
* @return DomainCollection<Username>
21+
* @return DomainCollection<array-key, Username>
2222
*/
2323
public function findAll(int $offset = 0, int $limit = 0): DomainCollection;
2424

0 commit comments

Comments
 (0)