Conditions | 6 |
Paths | 16 |
Total Lines | 35 |
Code Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public function load(ObjectManager $manager) |
||
19 | { |
||
20 | $metadata = $manager->getClassMetadata(Registration::class); |
||
21 | |||
22 | foreach ($metadata->entityListeners as $event => $listeners) { |
||
23 | foreach ($listeners as $key => $listener) { |
||
24 | if (UserListener::class === $listener['class']) { |
||
25 | unset($metadata->entityListeners[$event][$key]); |
||
|
|||
26 | } |
||
27 | } |
||
28 | } |
||
29 | |||
30 | $connection = $manager->getConnection(); |
||
31 | $platform = $connection->getDatabasePlatform()->getName(); |
||
32 | |||
33 | switch ($platform) { |
||
34 | case 'postgresql': |
||
35 | $connection->exec('ALTER SEQUENCE app_registration_id_seq RESTART WITH 1'); |
||
36 | break; |
||
37 | } |
||
38 | |||
39 | $objects = $this->parse($this->getResource()); |
||
40 | |||
41 | foreach ($objects as $object) { |
||
42 | $registration = new Registration; |
||
43 | $registration |
||
44 | ->setUuid($object->uuid) |
||
45 | ->setOwner($object->owner) |
||
46 | ->setOwnerUuid($object->owner_uuid) |
||
47 | ->setUsername($object->username) |
||
48 | ->setPassword($object->password) |
||
49 | ->setData($object->data) |
||
50 | ->setTenant($object->tenant); |
||
51 | $manager->persist($registration); |
||
52 | $manager->flush(); |
||
53 | } |
||
56 |