/** * Sets the isPublished state of this entity, to the $publishState provided. * * @param WorkHistory $workHistory The Work History to update published state. * * @param boolean $publishState True/False state. */ private function changePublishState(WorkHistory $workHistory, $publishState) { $workHistory->setIsPublished($publishState); $em = $this->getDoctrine()->getManager(); $em->persist($workHistory); $em->flush(); $this->get('session')->getFlashBag()->add('notice', json_encode(array('title' => 'Published state has been updated!', 'level' => 'info'))); return $this->redirect($this->generateUrl('admin_' . $this->ogEntity->getRouteStem())); }
private function renderWorkHistory(WorkHistory $workHistory) { $template_choice = $this->container->get('ilp_bootstrap_theme.theme_manager')->getTemplateChoice(); $securityContext = $this->container->get('security.context'); if (!$securityContext->isGranted('IS_AUTHENTICATED_FULLY')) { if (!$workHistory->getIsPublished()) { throw $this->createNotFoundException('The Work History Record you are looking for was not found.'); } } return $this->render('CorvusFrontendBundle:' . $template_choice . ':workHistoryId.html.twig', array('workHistory' => $workHistory)); }
public function __construct(EntityManager $em) { $this->originalEntityName = WorkHistory::getRepoName(); parent::__construct($em); }
public function load(ObjectManager $manager) { $workHistory = new WorkHistory(); $workHistory->setRowOrder(1); $workHistory->setEmployerName('Grumpy Pants Co'); $workHistory->setEmployerAddress('01 Dark Side of the Moon'); $workHistory->setStartDate(new \DateTime('01/01/0001')); $workHistory->setEndDate(new \DateTime('01/01/0003')); $workHistory->setRole('Pants Maker'); $workHistory->setDuties('Making pants for people to wear. Hanging around the water cooler. Staring at the secretary.'); $workHistory->setFeedbackReceived('Badass at makings pants. Banned from talking to the secretary :('); $workHistory->setReflection('In retrospect, I needed to be more sneaky while staring at the secretary.'); $workHistory->setEmployerPhoneNumber(1111111); $workHistory->setMetaTitle('Grumpy Pants Co'); $workHistory->setMetaDescription('Best company ever'); $manager->persist($workHistory); $manager->flush(); }