Пример #1
0
 public function addConfig($key, \Club\UserBundle\Entity\Location $location, $value)
 {
     $config = new \Club\UserBundle\Entity\LocationConfig();
     $config->setLocation($location);
     $config->setConfig($key);
     $config->setValue($value);
     return $config;
 }
 /**
  * @Route("/step/3")
  * @Template()
  */
 public function locationAction()
 {
     $this->validateInstaller();
     $em = $this->getDoctrine()->getManager();
     $location_step = new \Club\InstallerBundle\Step\LocationStep();
     $form = $this->createForm(new \Club\InstallerBundle\Form\LocationStep(), $location_step);
     if ($this->getRequest()->getMethod() == 'POST') {
         $form->bind($this->getRequest());
         if ($form->isValid()) {
             $location = new \Club\UserBundle\Entity\Location();
             $location->setLocationName($location_step->location_name);
             $location->setClub(true);
             $em->persist($location);
             $lc = new \Club\UserBundle\Entity\LocationConfig();
             $lc->setConfig('default_currency');
             $lc->setLocation($location);
             $lc->setValue($location_step->currency->getId());
             $em->persist($lc);
             $lc = new \Club\UserBundle\Entity\LocationConfig();
             $lc->setConfig('email_sender_address');
             $lc->setLocation($location);
             $lc->setValue('*****@*****.**');
             $em->persist($lc);
             $lc = new \Club\UserBundle\Entity\LocationConfig();
             $lc->setConfig('email_sender_name');
             $lc->setLocation($location);
             $lc->setValue('ClubMaster Administrator');
             $em->persist($lc);
             $em->flush();
             $this->get('session')->set('installer_location_id', $location->getId());
             return $this->redirect($this->generateUrl('club_installer_installer_confirm'));
         }
     }
     return array('form' => $form->createView());
 }
Пример #3
0
 public function load($manager)
 {
     $location = new \Club\UserBundle\Entity\Location();
     $location->setLocationName('ClubMaster');
     $manager->persist($location);
     $config = $this->getReference('config_account_default_cash');
     $lc = new \Club\UserBundle\Entity\LocationConfig();
     $lc->setLocation($location);
     $lc->setConfig($config->getConfigKey());
     $lc->setValue(1);
     $manager->persist($lc);
     $config = $this->getReference('config_account_default_income');
     $lc = new \Club\UserBundle\Entity\LocationConfig();
     $lc->setLocation($location);
     $lc->setConfig($config->getConfigKey());
     $lc->setValue(3);
     $manager->persist($lc);
     $config = $this->getReference('config_account_default_vat');
     $lc = new \Club\UserBundle\Entity\LocationConfig();
     $lc->setLocation($location);
     $lc->setConfig($config->getConfigKey());
     $lc->setValue(2);
     $manager->persist($lc);
     $config = $this->getReference('config_account_default_discount');
     $lc = new \Club\UserBundle\Entity\LocationConfig();
     $lc->setLocation($location);
     $lc->setConfig($config->getConfigKey());
     $lc->setValue(4);
     $manager->persist($lc);
     $config = $this->getReference('config_default_language');
     $lc = new \Club\UserBundle\Entity\LocationConfig();
     $lc->setLocation($location);
     $lc->setConfig($config->getConfigKey());
     $lc->setValue(1);
     $manager->persist($lc);
     $config = $this->getReference('config_default_currency');
     $lc = new \Club\UserBundle\Entity\LocationConfig();
     $lc->setLocation($location);
     $lc->setConfig($config->getConfigKey());
     $lc->setValue(1);
     $manager->persist($lc);
     $config = $this->getReference('config_default_location');
     $lc = new \Club\UserBundle\Entity\LocationConfig();
     $lc->setLocation($location);
     $lc->setConfig($config->getConfigKey());
     $lc->setValue(2);
     $manager->persist($lc);
     $config = $this->getReference('config_email_sender_address');
     $lc = new \Club\UserBundle\Entity\LocationConfig();
     $lc->setLocation($location);
     $lc->setConfig($config->getConfigKey());
     $lc->setValue('*****@*****.**');
     $manager->persist($lc);
     $config = $this->getReference('config_email_sender_name');
     $lc = new \Club\UserBundle\Entity\LocationConfig();
     $lc->setLocation($location);
     $lc->setConfig($config->getConfigKey());
     $lc->setValue('ClubMaster');
     $manager->persist($lc);
     $manager->flush();
 }