| Total Complexity | 4 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 12 | final class DistrictFixtures extends Fixture implements DependentFixtureInterface |
||
| 13 | { |
||
| 14 | public function load(ObjectManager $manager): void |
||
| 15 | { |
||
| 16 | foreach ($this->getDistrictData() as [$city, $name, $slug]) { |
||
| 17 | $district = new District(); |
||
| 18 | $district->setCity($city); |
||
| 19 | $district->setName($name); |
||
| 20 | $district->setSlug($slug); |
||
| 21 | $manager->persist($district); |
||
| 22 | $this->addReference($name, $district); |
||
| 23 | } |
||
| 24 | $manager->flush(); |
||
| 25 | } |
||
| 26 | |||
| 27 | private function getDistrictData(): array |
||
| 28 | { |
||
| 29 | return [ |
||
| 30 | // $districtData = [$city, $name, $slug]; |
||
| 31 | [$this->getReference('Tampa'), 'South Tampa', 'south-tampa'], |
||
| 32 | ]; |
||
| 33 | } |
||
| 34 | |||
| 35 | public function getDependencies() |
||
| 39 | ]; |
||
| 40 | } |
||
| 41 | } |
||
| 42 |