| Conditions | 5 |
| Paths | 7 |
| Total Lines | 38 |
| Code Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | public function load(ObjectManager $manager) : void |
||
| 35 | { |
||
| 36 | $i = 0; |
||
| 37 | $memberIds = []; |
||
| 38 | while ($i < $this->amount()) { |
||
| 39 | $ownerId = $this->getRandomUserByIndex($i); |
||
| 40 | $command = new CreateOrganizationCommand( |
||
| 41 | $ownerId, |
||
| 42 | 'Organization ' . $i, |
||
| 43 | $this->fakeIds()[$i] |
||
| 44 | ); |
||
| 45 | $memberIds[] = $ownerId; |
||
| 46 | |||
| 47 | $this->commandBus()->handle($command); |
||
| 48 | |||
| 49 | $iterations = $i % 5 > 6 ? 0 : 5 - $i % 6; |
||
| 50 | $j = 0; |
||
| 51 | while ($j < $iterations) { |
||
| 52 | $memberId = $this->getRandomUserByIndex($j); |
||
| 53 | if (in_array($memberId, $memberIds, true)) { |
||
| 54 | ++$j; |
||
| 55 | continue; |
||
| 56 | } |
||
| 57 | |||
| 58 | $this->commandBus()->handle( |
||
| 59 | new AddOrganizationMemberToOrganizationCommand( |
||
| 60 | $memberId, |
||
| 61 | $command->id(), |
||
| 62 | $ownerId |
||
| 63 | ) |
||
| 64 | ); |
||
| 65 | ++$j; |
||
| 66 | $memberIds[] = $memberId; |
||
| 67 | } |
||
| 68 | $memberIds = []; |
||
| 69 | ++$i; |
||
| 70 | } |
||
| 71 | } |
||
| 72 | } |
||
| 73 |