Ejemplo n.º 1
0
 /**
  * Load data fixtures with the passed EntityManager
  *
  * @param ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $client = new Client();
     $client->setMsisdn('380670000000');
     $client->setName('Гордей');
     $client->setCountry($this->getReference('country:ua'));
     $client->setClientDirection($this->getReference('clientDirection:internet'));
     $client->setGender(Client::GENDER_MALE);
     $manager->persist($client);
     $this->addReference('client:00', $client);
     $client = new Client();
     $client->setMsisdn('380671111111');
     $client->setName('Андрей');
     $client->setCountry($this->getReference('country:ua'));
     $client->setClientDirection($this->getReference('clientDirection:friends'));
     $client->setGender(Client::GENDER_MALE);
     $manager->persist($client);
     $this->addReference('client:01', $client);
     $client = new Client();
     $client->setMsisdn('3806722222222');
     $client->setName('Инна');
     $client->setCountry($this->getReference('country:ua'));
     $client->setClientDirection($this->getReference('clientDirection:return'));
     $client->setGender(Client::GENDER_FEMALE);
     $manager->persist($client);
     $this->addReference('client:02', $client);
     $manager->flush();
 }
Ejemplo n.º 2
0
 /**
  * @param ParameterBag $params
  *
  * @return object
  */
 public function create($params)
 {
     $entity = new Client();
     $entity->setCountry($params->get('country'));
     $entity->setClientDirection($params->get('clientDirection'));
     $entity->setMsisdn($params->get('msisdn'));
     $entity->setName($params->get('name'));
     $entity->setGender($params->get('gender'));
     $this->persist($entity);
     return $entity;
 }