mrprompt /
silex-api-skel
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | use Doctrine\Common\DataFixtures\AbstractFixture; |
||
| 3 | use Doctrine\Common\DataFixtures\OrderedFixtureInterface; |
||
| 4 | use Doctrine\Common\Persistence\ObjectManager; |
||
| 5 | use User\Entity\User as UserModel; |
||
| 6 | |||
| 7 | /** |
||
| 8 | * |
||
| 9 | * @author Thiago Paes <[email protected]> |
||
| 10 | */ |
||
| 11 | class User extends AbstractFixture implements OrderedFixtureInterface |
||
|
0 ignored issues
–
show
|
|||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Loader |
||
| 15 | * |
||
| 16 | * @param ObjectManager $manager |
||
| 17 | */ |
||
| 18 | public function load(ObjectManager $manager) |
||
| 19 | { |
||
| 20 | $i = 1; |
||
| 21 | $user = [ |
||
| 22 | 'name' => 'User ' . $i, |
||
| 23 | 'email' => 'user' . $i . '@users.net', |
||
| 24 | ]; |
||
| 25 | |||
| 26 | $obj = new UserModel(); |
||
| 27 | $obj->setName($user['name']); |
||
| 28 | $obj->setEmail($user['email']); |
||
| 29 | |||
| 30 | $manager->persist($obj); |
||
| 31 | $manager->flush(); |
||
| 32 | |||
| 33 | $this->addReference('user_' . $i, $obj); |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Load order |
||
| 38 | * |
||
| 39 | * @return int |
||
| 40 | */ |
||
| 41 | public function getOrder() |
||
| 42 | { |
||
| 43 | return 1; |
||
| 44 | } |
||
| 45 | } |
||
| 46 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.