private function createFakeProvider() { $provider = new Provider(); $baseFaker = \Faker\Factory::create(); $provider->setName($baseFaker->company); $provider->setCountry($baseFaker->country); $provider->setType($this->getRandomType()); $provider->setDescription($baseFaker->text(500)); $provider->setUrl($baseFaker->url); $provider->setLastModification($baseFaker->dateTime); $nb = rand(1, 5); for ($x = 0; $x <= $nb; $x++) { $contactFaker = \Faker\Factory::create(); $c = new Contact(); $c->setProvider($provider); $c->setFirstName($contactFaker->firstName); $c->setLastName($contactFaker->lastName); $c->setGender(Personne::GENDER_MALE); $c->setEmail($contactFaker->email); $c->setTelephone($contactFaker->phoneNumber); $c->setDescription($contactFaker->text(300)); $c->setComment($contactFaker->text(100)); $this->output('create fake contact'); $this->em->persist($c); } $this->em->persist($provider); $this->output('create fake provider'); return $provider; }