Esempio n. 1
0
 /**
  * @return Response
  */
 public function countriesAction()
 {
     die('nope');
     $em = $this->getDoctrine()->getManager();
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, 'http://api.geonames.org/countryInfoJSON?username=nebs');
     http:
     //api.geonames.org/countryInfoJSON?username=nebs&lang=hr
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
     // Assuming you're requesting JSON
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $response = curl_exec($ch);
     // If using JSON...
     $data = json_decode($response);
     foreach ($data->geonames as $country) {
         $name = $country->countryName;
         $code = $country->countryCode;
         $countryObj = new Country();
         $countryObj->setName($name);
         $countryObj->setCode($code);
         $em->persist($countryObj);
         $em->flush();
     }
     return $this->render('AdminBundle::parse.html.twig', array('data' => $data->geonames));
 }
Esempio n. 2
0
 /**
  * @Route("/generate", name="fakeEntityGenerator")
  * @Method("GET")
  */
 public function generateAction()
 {
     $faker = Factory::create();
     $em = $this->getDoctrine()->getManager();
     foreach ($this->countryNames as $countryName) {
         $country = new Country();
         $country->setName($countryName);
         $country->setFlag($countryName . '.png');
         $country->setDescription($faker->text(3000));
         $team = new Team();
         $team->setName($countryName);
         $team->setDescription($faker->text(3000));
         $team->setCountry($country);
         for ($i = 0; $i < 16; $i++) {
             $player = new Player();
             $player->setName($faker->name);
             $player->setDescription($faker->text(3000));
             $player->setTeam($team);
             $em->persist($player);
         }
         for ($i = 0; $i < 4; $i++) {
             $coach = new Coach();
             $coach->setName($faker->name);
             $coach->setDescription($faker->text(3000));
             $coach->setTeam($team);
             $em->persist($coach);
         }
         $em->persist($country);
         $em->persist($team);
     }
     $em->flush();
     return $this->redirectToRoute('homePage');
 }
Esempio n. 3
0
 public function postUp(Schema $schema)
 {
     /** @var \Doctrine\ORM\EntityManager $em */
     $em = $this->container->get('doctrine.orm.entity_manager');
     /** @var \FOS\UserBundle\Model\UserManager $userManager */
     $userManager = $this->container->get('fos_user.user_manager');
     /** @var \AppBundle\Entity\User $userAdmin */
     $userAdmin = $userManager->createUser();
     $userAdmin->setUsername('admin');
     $userAdmin->setEmail('*****@*****.**');
     $userAdmin->setPlainPassword('admin');
     $userAdmin->setEnabled(true);
     $userAdmin->setRoles(array('ROLE_SUPER_ADMIN'));
     $userManager->updateUser($userAdmin, true);
     /** @var  \AppBundle\Entity\Country $country */
     $country = new Country();
     $country->setCountryCode('US');
     $country->setName('United States of America');
     $em->persist($country);
     $em->flush();
     $states = array('AL' => 'Alabama', 'AK' => 'Alaska', 'AZ' => 'Arizona', 'AR' => 'Arkansas', 'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware', 'DC' => 'District of Columbia', 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine', 'MD' => 'Maryland', 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', 'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma', 'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina', 'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah', 'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia', 'WI' => 'Wisconsin', 'WY' => 'Wyoming');
     foreach ($states as $k => $v) {
         /** @var  \AppBundle\Entity\StateProv $stateProv */
         $state = new StateProv();
         $state->setCountryCode($country);
         $state->setStateProvinceCode($k);
         $state->setName($v);
         $em->persist($state);
     }
     $em->flush();
 }
 /**
  * Load data fixtures with the passed EntityManager
  *
  * @param ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $countryNames = array('Afrique du Sud', 'Afghanistan', 'Albanie', 'Algérie', 'Allemagne', 'Andorre', 'Angola', 'Anguilla', 'Antarctique', 'Antigua-et-Barbuda', 'Antilles Néerlandaises', 'Arabie Saoudite', 'Argentine', 'Arménie', 'Aruba', 'Australie', 'Autriche', 'Azerbaïdjan', 'Bahamas', 'Bahreïn', 'Bangladesh', 'Barbade', 'Bélarus', 'Belgique', 'Belize', 'Bénin', 'Bermudes', 'Bhoutan', 'Bolivie', 'Bosnie-Herzégovine', 'Botswana', 'Brésil', 'Brunéi Darussalam', 'Bulgarie', 'Burkina Faso', 'Burundi', 'Cambodge', 'Cameroun', 'Canada', 'Cap-vert', 'Chili', 'Chine', 'Chypre', 'Colombie', 'Comores', 'Costa Rica', 'Côte d\'Ivoire', 'Croatie', 'Cuba', 'Danemark', 'Djibouti', 'Dominique', 'Égypte', 'El Salvador', 'Émirats Arabes Unis', 'Équateur', 'Érythrée', 'Espagne', 'Estonie', 'États Fédérés de Micronésie', 'États-Unis', 'Éthiopie', 'Fédération de Russie', 'Fidji', 'Finlande', 'France', 'Gabon', 'Gambie', 'Géorgie du Sud et les Îles Sandwich du Sud', 'Géorgie', 'Ghana', 'Gibraltar', 'Grèce', 'Grenade', 'Groenland', 'Guadeloupe', 'Guam', 'Guatemala', 'Guinée Équatoriale', 'Guinée-Bissau', 'Guinée', 'Guyana', 'Guyane Française', 'Haïti', 'Honduras', 'Hong-Kong', 'Hongrie', 'Île Bouvet', 'Île Christmas', 'Île de Man', 'Île Norfolk', 'Îles (malvinas) Falkland', 'Îles Åland', 'Îles Caïmanes', 'Îles Cocos (Keeling)', 'Îles Cook', 'Îles Féroé', 'Îles Heard et Mcdonald', 'Îles Mariannes du Nord', 'Îles Marshall', 'Îles Mineures Éloignées des États-Unis', 'Îles Salomon', 'Îles Turks et Caïques', 'Îles Vierges Britanniques', 'Îles Vierges des États-Unis', 'Inde', 'Indonésie', 'Iraq', 'Irlande', 'Islande', 'Israël', 'Italie', 'Jamahiriya Arabe Libyenne', 'Jamaïque', 'Japon', 'Jordanie', 'Kazakhstan', 'Kenya', 'Kirghizistan', 'Kiribati', 'Koweït', 'L\'ex-République Yougoslave de Macédoine', 'Lesotho', 'Lettonie', 'Liban', 'Libéria', 'Liechtenstein', 'Lituanie', 'Luxembourg', 'Macao', 'Madagascar', 'Malaisie', 'Malawi', 'Maldives', 'Mali', 'Malte', 'Maroc', 'Martinique', 'Maurice', 'Mauritanie', 'Mayotte', 'Mexique', 'Monaco', 'Mongolie', 'Montserrat', 'Mozambique', 'Myanmar', 'Namibie', 'Nauru', 'Népal', 'Nicaragua', 'Niger', 'Nigéria', 'Niué', 'Norvège', 'Nouvelle-Calédonie', 'Nouvelle-Zélande', 'Oman', 'Ouganda', 'Ouzbékistan', 'Pakistan', 'Palaos', 'Panama', 'Papouasie-Nouvelle-Guinée', 'Paraguay', 'Pays-Bas', 'Pérou', 'Philippines', 'Pitcairn', 'Pologne', 'Polynésie Française', 'Porto Rico', 'Portugal', 'Qatar', 'République Arabe Syrienne', 'République Centrafricaine', 'République de Corée', 'République de Moldova', 'République Démocratique du Congo', 'République Démocratique Populaire Lao', 'République Dominicaine', 'République du Congo', 'République Islamique d\'Iran', 'République Populaire Démocratique de Corée', 'République Tchèque', 'République-Unie de Tanzanie', 'Réunion', 'Roumanie', 'Royaume-Uni', 'Rwanda', 'Sahara Occidental', 'Saint-Kitts-et-Nevis', 'Saint-Marin', 'Saint-Pierre-et-Miquelon', 'Saint-Siège (état de la Cité du Vatican)', 'Saint-Vincent-et-les Grenadines', 'Sainte-Hélène', 'Sainte-Lucie', 'Samoa Américaines', 'Samoa', 'Sao Tomé-et-Principe', 'Sénégal', 'Serbie-et-Monténégro', 'Seychelles', 'Sierra Leone', 'Singapour', 'Slovaquie', 'Slovénie', 'Somalie', 'Soudan', 'Sri Lanka', 'Suède', 'Suisse', 'Suriname', 'Svalbard etÎle Jan Mayen', 'Swaziland', 'Tadjikistan', 'Taïwan', 'Tchad', 'Terres Australes Françaises', 'Territoire Britannique de l\'Océan Indien', 'Territoire Palestinien Occupé', 'Thaïlande', 'Timor-Leste', 'Togo', 'Tokelau', 'Tonga', 'Trinité-et-Tobago', 'Tunisie', 'Turkménistan', 'Turquie', 'Tuvalu', 'Ukraine', 'Uruguay', 'Vanuatu', 'Venezuela', 'Viet Nam', 'Wallis et Futuna', 'Yémen', 'Zambie', 'Zimbabwe');
     foreach ($countryNames as $countryName) {
         $country = new Country();
         $country->setName($countryName);
         $manager->persist($country);
     }
     $manager->flush();
 }
Esempio n. 5
0
 protected function createAndPersistData()
 {
     $countryCount = 0;
     foreach ($this->countries as $code => $country) {
         $countryCount++;
         $countryEntity = new Country();
         $countryEntity->setCode($code)->setName($country[0])->setCurrency($country[1]);
         $this->setReference(sprintf('country_%s', $countryCount), $countryEntity);
         $this->manager->persist($countryEntity);
     }
 }
Esempio n. 6
0
    /**
     * @Route("/country/info/set", name="country_info_set")
     */
    public function setCountryAction()
    {
        $em = $this->getDoctrine()->getManager();
        $title = 'Бельгия';
        $body = ' <div class="col-xs-5"><img src="/bundles/app/images/img-country-11.png"></div>
                    <div class="col-xs-7">
                        <table class="tbl">
                            <tr>
                                <td class="th1" style="width: 120px">Тип визы</td>
                                <td class="th2" style="width: 150px">Срок оформления</td>
                                <td class="th3">Подача документов через аккредитованное агентство</td>
                                <td class="th4">Личная подача документов в визовый центр</td>
                            </tr>
                            <tr>
                                <td>до 15 дней</td>
                                <td>5-6 рабочих дней</td>
                                <td class="euro">160€</td>
                                <td class="euro">80€</td>
                            </tr>
                            <tr>
                                <td>до 30/90 дней</td>
                                <td>5-6 рабочих дней</td>
                                <td class="euro">240€</td>
                                <td class="euro">140€</td>
                            </tr>
                            <tr>
                                <td>до 90/180 дней</td>
                                <td>5-6 рабочих дней</td>
                                <td class="euro">350€</td>
                                <td class="euro">200€</td>
                            </tr>

                            <tr>
                                <td>180/365 бизн.млт.</td>
                                <td>5-6 рабочих дней</td>
                                <td class="euro">400€</td>
                                <td class="euro">300€</td>
                            </tr>
                            <tr>
                                <td>2 года бизн.млт.</td>
                                <td>5-6 рабочих дней</td>
                                <td class="euro">550€</td>
                                <td class="euro">350€</td>
                            </tr>
                        </table>
                    </div>';
        $country = new Country();
        $country->setTitle($title);
        $country->setBody($body);
        //        $em->persist($country);
        //        $em->flush($country);
        return new Response($body);
    }
Esempio n. 7
0
 public function generateCountry()
 {
     $faker = Factory::create();
     $country = new Country();
     $em = $this->getDoctrine()->getManager();
     for ($i = 0; $i < 10; $i++) {
         $country->setFullTitle($faker->country);
         $country->setDescription($faker->text);
         $em->persist($country);
     }
     $em->flush();
     $this->redirectToRoute('homepage');
 }
Esempio n. 8
0
 public function load(ObjectManager $manager)
 {
     $faker = Factory::create();
     foreach ($this->countries as $key => $value) {
         $country = new Country();
         static $i = 1;
         $country->setTitle($value);
         $country->setInfo($faker->realText($maxNbChars = 3000, $indexSize = 2));
         $country->setFlag('/image/flag_of_country/Flag_of_' . $value . '.svg.png');
         $this->addReference("country {$i}", $country);
         $i++;
         $manager->persist($country);
     }
     $manager->flush();
 }
 /**
  * @Route("/admin/insert/country/{id}", name="country_insert_admin", requirements={"id" : "\d+"})
  *
  */
 public function generateCountryAction($id)
 {
     $teams = $this->getDoctrine()->getRepository('AppBundle:Team')->find($id);
     if (!$teams) {
         throw $this->createNotFoundException('Not found');
     }
     $faker = Factory::create();
     $em = $this->getDoctrine()->getManager();
     $country = new Country();
     $country->setTeam($teams);
     $country->setFullTitle($faker->country);
     $country->setDescription($faker->text);
     $em->persist($country);
     $em->flush();
     $this->addFlash('notice', 'Add country!');
     return $this->forward('AppBundle:Admin:show');
 }
Esempio n. 10
0
 public function load(ObjectManager $manager)
 {
     $faker = \Faker\Factory::create();
     $x = 0;
     while ($x++ < 25) {
         $contryname = $faker->country($x);
         $slug = str_replace(' ', '-', $contryname);
         $slug = preg_replace('/[^A-Za-z\\-]/', '', $slug);
         $country = new Country();
         $country->setName($contryname);
         $country->setSlug(strtolower($slug));
         $country->setDescription($faker->text);
         $country->setImage($faker->imageUrl(22, 15));
         $manager->persist($country);
         $manager->flush();
         $this->addReference("country-{$x}", $country);
     }
 }
Esempio n. 11
0
 public function load(ObjectManager $manager)
 {
     $faker = \Faker\Factory::create();
     $countries = ['France', 'England', 'Czech Republic', 'Iceland', 'Austria', 'Northern Ireland', 'Portugal', 'Spain', 'Switzerland', 'Italy', 'Belgium', 'Wales', 'Romania', 'Albania', 'Germany', 'Poland', 'Russia', ' Slovakia', 'Croatia', 'Turkey', 'Hungary', 'Republic of Ireland', 'Sweden', 'Ukraine'];
     $x = -1;
     foreach ($countries as $x => $value) {
         $contryname = $value;
         $slug = str_replace(' ', '-', $contryname);
         $slug = preg_replace('/[^A-Za-z\\-]/', '', $slug);
         $country = new Country();
         $country->setName($contryname);
         $country->setSlug(strtolower($slug));
         $country->setDescription($faker->text);
         $country->setImage($faker->imageUrl(22, 15));
         $manager->persist($country);
         $manager->flush();
         $this->addReference("country-{$x}", $country);
     }
 }
Esempio n. 12
0
 /**
  * @Route("/Team/create")
  */
 public function createActionTeam($teamName, $countryName)
 {
     $country = new Country();
     $country->setCountryName($countryName);
     $team = new Team();
     $team->setCountryId($countryId);
     $team->setTeamName($teamName);
     // relate this product to the category
     $team->setCountry($country);
     $em = $this->getDoctrine()->getManager();
     $em->persist($team);
     $em->flush();
     $teamArray[] = $team->getId();
     $teamArray[] = $team->getCountryId();
     $teamArray[] = $country->getId();
     $teamArray[] = $country->getCountryName();
     return new Response(json_encode($teamArray));
 }
Esempio n. 13
0
 /**
  * Creates a form to delete a Country entity.
  *
  * @param Country $country The Country entity
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createDeleteForm(Country $country)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('country_delete', array('id' => $country->getId())))->setMethod('DELETE')->getForm();
 }
Esempio n. 14
0
 /**
  * @Route("/country/create", name="country_create")
  */
 public function createCountryAction()
 {
     $country = new Country();
     $country->setName('USA');
     $em = $this->getDoctrine()->getManager();
     $em->persist($country);
     $em->flush();
     return new Response('Created country id ' . $country->getId());
 }