/** * @param ParameterBag $params * * @return object */ public function create($params) { $entity = new Diagnosis(); $entity->setDescription($params->get('description')); $entity->setPerson($params->get('person')); $this->persist($entity); }
/** * Load data fixtures with the passed EntityManager * * @param ObjectManager $manager */ public function load(ObjectManager $manager) { foreach ($this->personData as $personRef => $diagnosisText) { $diagnosis = new Diagnosis(); $diagnosis->setPerson($this->getReference($personRef)); $diagnosis->setDescription($diagnosisText); $manager->persist($diagnosis); } $manager->flush(); }