/** * {@inheritDoc} */ public function load(ObjectManager $manager) { $exp = new Experience(); $exp->setLookingForTeam(true); $exp->setRankActual('Silver I'); $exp->setUsername('xXKira29Xx'); $exp->setRole1($this->getReference('role')); $exp->setRole2($this->getReference('role1')); $exp->setRole3($this->getReference('role2')); $exp->setRole4($this->getReference('role3')); $exp->setRole5($this->getReference('role4')); $manager->persist($exp); $exp1 = new Experience(); $exp1->setLookingForTeam(false); $exp1->setRankActual('Silver V'); $exp1->setUsername('xXKillerDu33LeBoGoSsXx'); $exp1->setRole1($this->getReference('role11')); $exp1->setRole2($this->getReference('role10')); $exp1->setRole3($this->getReference('role5')); $exp1->setRole4($this->getReference('role6')); $exp1->setRole5($this->getReference('role7')); $manager->persist($exp1); $manager->flush(); $this->addReference('kira', $exp); $this->addReference('killer', $exp1); }
/** * @Route("/add-experience", name="app_talent_add_experience", options={"expose"=true}) * @Method("POST") */ public function addExperienceAction(Request $request) { $cv = $this->getUser()->getCv(); if ($request->isXmlHttpRequest() && $cv) { $experience = new Experience(); $experience->setCv($cv); $form = $this->createForm(ExperienceType::class, $experience, ['csrf_protection' => false]); $form->handleRequest($request); $form->submit($request->request->get('app_experience')); if ($form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($experience); $em->flush(); return new JsonResponse(['success' => true, 'experience' => $this->renderView(':front/talent:experience.html.twig', ['experience' => $experience])]); } } return new JsonResponse(['success' => false]); }
/** * @param Experience $experience * * @return $this */ public function addExperience(Experience $experience) { $this->experiences[] = $experience; $experience->setCv($this); return $this; }