/** * Load data fixtures with the passed EntityManager * * @param ObjectManager $manager */ public function load(ObjectManager $manager) { $county = new Country(); $county->setName('Ukraine'); $county->setIso2('ua'); $county->setPrefix('38'); $county->setPattern('^380[3-9]{1}[0-9]{8}$'); $county->setLength(12); $manager->persist($county); $manager->flush(); $this->addReference('country:ua', $county); }
/** * @param ParameterBag $params * * @return object */ public function create($params) { $entity = new Country(); $entity->setName($params->get('name')); $entity->setIso2($params->get('iso2')); $entity->setPattern($params->get('pattern')); $entity->setPrefix($params->get('prefix')); $this->persist($entity); }