protected function execute(InputInterface $input, OutputInterface $output) { // get list of URL $em = $this->getContainer()->get('doctrine.orm.entity_manager'); // Get Marée $spotList = $em->getRepository('LaPoizWindBundle:Spot')->findAll(); $output->writeln('<info>************** DELETE MAREE ****************</info>'); foreach ($spotList as $spot) { if ($spot->getMareeURL() != null) { MareeGetData::deleteMaree($spot, $em, $output); } } }
/** * @Template() * Efface les prévisions de marée * http://localhost/Wind/web/app_dev.php/admin/BO/ajax/spot/maree/delete/1 */ public function mareeDeleteAction($id) { $em = $this->container->get('doctrine.orm.entity_manager'); $spot = $em->find('LaPoizWindBundle:Spot', $id); if (!$spot) { return $this->container->get('templating')->renderResponse('LaPoizWindBundle:Default:errorBlock.html.twig', array('errMessage' => "Spot not find !")); } $mareeURL = $spot->getMareeURL(); if (!empty($mareeURL)) { MareeGetData::deleteMaree($spot, $em, new NullOutput()); } $mareeDateDB = $em->getRepository('LaPoizWindBundle:MareeDate')->findLastPrev(10, $spot); return $this->container->get('templating')->renderResponse('LaPoizWindBundle:BackOffice/Spot/Ajax/Maree:mareeSaveResult.html.twig', array('mareeDateDB' => $mareeDateDB, 'spot' => $spot, 'message' => "", 'saveSuccess' => true)); }