/** * @Route("/states/{state}", name="civix_front_superuser_settings_states_update") * @Method({"POST"}) * @Template("CivixFrontBundle:Superuser:statesSettings.html.twig") */ public function statesUpdateAction(State $state) { $csrfProvider = $this->get('form.csrf_provider'); if ($csrfProvider->isCsrfTokenValid('state_repr_update_' . $state->getCode(), $this->getRequest()->get('_token'))) { $this->get('civix_core.queue_task')->addToQueue('Civix\\CoreBundle\\Service\\Representative\\RepresentativeSTManager', 'synchronizeByStateCode', array($state->getCode())); $this->get('session')->getFlashBag()->add('notice', 'The representatives of the State will be updated.'); } else { $this->get('session')->getFlashBag()->add('error', 'State is not found'); } return $this->redirect($this->generateUrl('civix_front_superuser_settings_states')); }
public function load(ObjectManager $manager) { $dataFileHandler = fopen($this->dataFile, 'r'); while (($csvRow = fgetcsv($dataFileHandler)) !== false) { $state = new State(); $state->setName($csvRow[0]); $state->setCode($csvRow[1]); $manager->persist($state); } fclose($dataFileHandler); $manager->flush(); }
public function getStRepresentatives() { $this->__load(); return parent::getStRepresentatives(); }