/**
  * Load data fixtures with the passed EntityManager
  *
  * @param ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $repository = $manager->getRepository('Gedmo\\Translatable\\Entity\\Translation');
     $sidebar = new Sidebar\Template\Block();
     $sidebar->setTranslatableLocale('en');
     $sidebar->setActive(true);
     $sidebar->setSlug('form-group-sidebar');
     $sidebar->setName('[GROUP] Sidebar Group form');
     $sidebar->setTemplate('block_sidebarFiche');
     $manager->persist($sidebar);
     $block = new TitleDesc();
     $block->setTranslatableLocale('en');
     $block->setActive(true);
     $block->setName('Votre contact pour une demande de séjour groupe');
     $block->setSlug('group-information');
     $block->setTitle('Contact us');
     $block->setDescription('
         <h3 class="title3">Your contact to request a group stay</h3>
         <p><strong>Group team</strong><br>
         <p>Tel 01.70.23.81.64<br>
         <p><a href="mailto:groupes@seh-hotels.com">groupes@seh-hotels.com</a><br>
     ');
     $block->setTemplate('title_desc_coordonnees');
     $repository->translate($block, 'title', 'fr', 'Nos coordonnées');
     $repository->translate($block, 'description', 'fr', '
         <h3 class="title3">Votre contact pour une demande de séjour groupe</h3>
         <p><strong>Service groupes</strong><br>
         <p>Tel 01.70.23.81.64<br>
         <p><a href="mailto:groupes@seh-hotels.com">groupes@seh-hotels.com</a><br>
     ');
     $manager->persist($block);
     $sidebarBlock = new SidebarBlock();
     $sidebarBlock->setBlock($block);
     $sidebarBlock->setSidebar($sidebar);
     $sidebarBlock->setPosition(0);
     $sidebarBlock->setTemplate('title_desc/title_desc_coordonnees');
     $sidebar->addBlock($sidebarBlock);
     $page = new Page\Template\TitleDescMediaBlockSidebar();
     $page->setActive(true);
     $page->setTranslatableLocale('en');
     $page->setName('Formulaire de Groupe');
     $page->setSlug('group-form');
     $page->setTitle('Formulaire groupe');
     $page->setDescription('');
     $page->setTemplate('title_desc_media_block_sidebar_form');
     $manager->persist($page);
     $sidebarPage = new PageSidebar();
     $sidebarPage->setSidebar($sidebar);
     $sidebarPage->setPage($page);
     $sidebarPage->setPosition(0);
     $sidebarPage->setTemplate('title_desc/block_sidebar_form');
     $page->addSidebar($sidebarPage);
     // Block 1
     $block = new TitleDesc();
     $block->setTranslatableLocale('en');
     $block->setActive(true);
     $block->setName('[Formulaire de Groupe] Notre offre pour les groupes');
     $block->setSlug('block-group-form-1');
     $block->setTitle('');
     $block->setDescription('
     <h2 class="title2 lowerCase">Our offer for groups</h2>
     <p>Are you a group of at least fifteen people and do you want to organise a stay in a hotel? Through its four hotel brands and its specialist group bookings team, SEH has a variety of offers for all budgets.</p>
     <h2 class="title2 lowerCase">Friendly and authentic accommodation</h2>
     <p>If you wish to go away for a weekend or a longer time, SEH offers group rates to suit all budgets.</p>
     <h2 class="title2 lowerCase">Quality services adapted to your wishes</h2>
     <p>Our knowledge of all the group hotels and our expertise enable us to give you advice and direct you to the hotel that will best meet your expectations.</p>
     <h2 class="title2 lowerCase">Hoteliers driven by a liking for their region to advise you during your stay</h2>
     <p>And if you need advice about where to go in the region or about activities of any kind, don\'t hesitate to ask! Our hoteliers will be able to guide you and recommend the best options for your group stay..</p>
     <p>For any request for information about a planned group stay, please fill in the questionnaire below:</p>
     ');
     $block->setTemplate('title_desc_h2');
     $repository->translate($block, 'description', 'fr', '
     <h2 class="title2 lowerCase">Notre offre pour les groupes</h2>
     <p>Vous êtes un groupe de 15 personnes minimum et vous souhaitez organiser un séjour dans un hôtel ? La SEH vous propose au travers de ses 4 marques hôtelières et de son service spécialisé dans les demandes de réservation pour les groupes, une offre variée pour tous les budgets.</p>
     <h2 class="title2 lowerCase">Un hébergement convivial et authentique</h2>
     <p>Vous souhaitez partir pour un week-end ou un séjour, la SEH vous propose des tarifs groupes adaptés à tous les budgets.</p>
     <h2 class="title2 lowerCase">Des services de qualité adaptés à vos envies</h2>
     <p>Notre connaissance de tous les hôtels du groupe et notre savoir-faire nous permettent de vous conseiller et vous orienter sur l’établissement correspondant le mieux à vos attentes.</p>
     <h2 class="title2 lowerCase">Des hôteliers animés par le goût de leur région pour vous conseiller lors de votre séjour</h2>
     <p>Et si vous avez besoin de conseils pour visiter la région ou pratiquer des activités de toutes sortes, n’hésitez pas ! Nos hôteliers sauront vous guider et vous recommander le meilleur pour votre séjour en groupe.</p>
     <p>Pour toute demande de renseignement sur un projet de séjour en groupe, merci de bien vouloir remplir le questionnaire ci-dessous :</p>
     ');
     $manager->persist($block);
     $pageBlock = new PageBlock();
     $pageBlock->setBlock($block);
     $pageBlock->setPage($page);
     $pageBlock->setPosition(0);
     $pageBlock->setTemplate('title_desc/title_desc_h2');
     $page->addBlock($pageBlock);
     // End Block 1
     // Block Formulaire de Groupe
     $block = new TitleDesc();
     $block->setTranslatableLocale('en');
     $block->setActive(true);
     $block->setName('[Formulaire de Groupe] Demande de devis');
     $block->setSlug('block-group-form-6');
     $block->setTitle('Demande de devis');
     $block->setDescription('');
     $block->setTemplate('title_desc_h2');
     $block->setAction('form_group');
     $repository->translate($block, 'title', 'fr', 'Demande de devis');
     $manager->persist($block);
     $pageBlock = new PageBlock();
     $pageBlock->setBlock($block);
     $pageBlock->setPage($page);
     $pageBlock->setPosition(5);
     $pageBlock->setTemplate('title_desc/title_desc_h2');
     $page->addBlock($pageBlock);
     // End Formulaire de Groupe
     // Listes déroulantes
     $groupType = new GroupType();
     $groupType->setTranslatableLocale('en');
     $groupType->setName('An organisation');
     $repository->translate($groupType, 'name', 'fr', 'Une association');
     $manager->persist($groupType);
     $groupType = new GroupType();
     $groupType->setTranslatableLocale('en');
     $groupType->setName('A sports/leisure activity team');
     $repository->translate($groupType, 'name', 'fr', 'Une équipe de sport / loisirs');
     $manager->persist($groupType);
     $groupType = new GroupType();
     $groupType->setTranslatableLocale('en');
     $groupType->setName('A group of friends');
     $repository->translate($groupType, 'name', 'fr', 'Un groupe d\'amis');
     $manager->persist($groupType);
     $groupType = new GroupType();
     $groupType->setTranslatableLocale('en');
     $groupType->setName('Other');
     $repository->translate($groupType, 'name', 'fr', 'Autre');
     $manager->persist($groupType);
     $groupTitle = new GroupTitle();
     $groupTitle->setTranslatableLocale('en');
     $groupTitle->setName('Ms');
     $repository->translate($groupTitle, 'name', 'fr', 'Madame');
     $manager->persist($groupTitle);
     $groupTitle = new GroupTitle();
     $groupTitle->setTranslatableLocale('en');
     $groupTitle->setName('Mr');
     $repository->translate($groupTitle, 'name', 'fr', 'Monsieur');
     $manager->persist($groupTitle);
     $groupCountry = new GroupCountry();
     $groupCountry->setTranslatableLocale('en');
     $groupCountry->setName('Germany');
     $repository->translate($groupCountry, 'name', 'fr', 'Allemagne');
     $manager->persist($groupCountry);
     $groupCountry = new GroupCountry();
     $groupCountry->setTranslatableLocale('en');
     $groupCountry->setName('Belgium');
     $repository->translate($groupCountry, 'name', 'fr', 'Belgique');
     $manager->persist($groupCountry);
     $groupCountry = new GroupCountry();
     $groupCountry->setTranslatableLocale('en');
     $groupCountry->setName('Spain');
     $repository->translate($groupCountry, 'name', 'fr', 'Espagne');
     $manager->persist($groupCountry);
     $groupCountry = new GroupCountry();
     $groupCountry->setTranslatableLocale('en');
     $groupCountry->setName('France');
     $repository->translate($groupCountry, 'name', 'fr', 'France');
     $manager->persist($groupCountry);
     $groupCountry = new GroupCountry();
     $groupCountry->setTranslatableLocale('en');
     $groupCountry->setName('Italy');
     $repository->translate($groupCountry, 'name', 'fr', 'Italie');
     $manager->persist($groupCountry);
     $groupCountry = new GroupCountry();
     $groupCountry->setTranslatableLocale('en');
     $groupCountry->setName('Luxembourg');
     $repository->translate($groupCountry, 'name', 'fr', 'Luxembourg');
     $manager->persist($groupCountry);
     $groupCountry = new GroupCountry();
     $groupCountry->setTranslatableLocale('en');
     $groupCountry->setName('Netherlands');
     $repository->translate($groupCountry, 'name', 'fr', 'Pays-bas');
     $manager->persist($groupCountry);
     $groupTypeOfRoom = new GroupTypeOfRoom();
     $groupTypeOfRoom->setTranslatableLocale('en');
     $groupTypeOfRoom->setName('Single');
     $repository->translate($groupTypeOfRoom, 'name', 'fr', '1 personne');
     $manager->persist($groupTypeOfRoom);
     $groupTypeOfRoom = new GroupTypeOfRoom();
     $groupTypeOfRoom->setTranslatableLocale('en');
     $groupTypeOfRoom->setName('Double');
     $repository->translate($groupTypeOfRoom, 'name', 'fr', '2 personnes 1 lit');
     $manager->persist($groupTypeOfRoom);
     $groupTypeOfRoom = new GroupTypeOfRoom();
     $groupTypeOfRoom->setTranslatableLocale('en');
     $groupTypeOfRoom->setName('Twin');
     $repository->translate($groupTypeOfRoom, 'name', 'fr', '2 personnes 2 lits');
     $manager->persist($groupTypeOfRoom);
     $groupHotelCategory = new GroupHotelCategory();
     $groupHotelCategory->setTranslatableLocale('en');
     $groupHotelCategory->setName('Economy, from €40/night');
     $repository->translate($groupHotelCategory, 'name', 'fr', 'Economique, à partir de 40€/nuit');
     $manager->persist($groupHotelCategory);
     $groupHotelCategory = new GroupHotelCategory();
     $groupHotelCategory->setTranslatableLocale('en');
     $groupHotelCategory->setName('2 and 3 stars, from €65/night');
     $repository->translate($groupHotelCategory, 'name', 'fr', '2 et 3 étoiles, à partir de 65€/nuit');
     $manager->persist($groupHotelCategory);
     $groupHotelCategory = new GroupHotelCategory();
     $groupHotelCategory->setTranslatableLocale('en');
     $groupHotelCategory->setName('Superior, from €80/night');
     $repository->translate($groupHotelCategory, 'name', 'fr', 'Supérieur, à partir de 80€/nuit');
     $manager->persist($groupHotelCategory);
     $groupHotelCategory = new GroupHotelCategory();
     $groupHotelCategory->setTranslatableLocale('en');
     $groupHotelCategory->setName('Charming hotels, from €100/night');
     $repository->translate($groupHotelCategory, 'name', 'fr', 'Hôtels de charme, à partir de 100€/nuit');
     $manager->persist($groupHotelCategory);
     // Fin Listes déroulantes
     $manager->flush();
 }
 protected function importLang($brand, $lang)
 {
     $translationRepository = $this->getTranslationRepository();
     $translationDir = $this->getContainer()->getParameter('translation_dir') . '/lot_5/';
     $defaultLang = 'en';
     $em = $this->getEntityManager();
     $translationfiles = scandir($translationDir . strtoupper($lang) . '/');
     $exclude = array('.', '..');
     $translationfiles = array_diff($translationfiles, $exclude);
     foreach (array_values($translationfiles) as $translationFile) {
         $file = $translationDir . strtoupper($lang) . '/' . $translationFile;
         $handle = fopen($file, "r");
         while (($line = fgetcsv($handle)) !== false) {
             if ($line) {
                 list($brandId, $regionId, $pageName, $pageTitle, $pageDescription, $block1Title, $block1Description, $block2Title, $block2Description, $block3Title, $block3Description, $block4Title, $block4Description, $block5Title, $block5Description, $imageTitle1, $imageTitle2, $imageTitle3) = $line;
                 $name = sprintf('[%s] Region hotelier - %s [%s]', $brandId, $pageName, $regionId);
                 $page = $em->getRepository('BigfootContentBundle:Page\\Template\\TitleDescMediaBlockSidebar')->createQueryBuilder('p')->where('p.name LIKE :name')->setParameter(':name', sprintf('%%[%s]%%', $regionId))->getQuery()->setHint(\Gedmo\Translatable\TranslatableListener::HINT_TRANSLATABLE_LOCALE, 'en')->getOneOrNullResult();
                 if (!$page) {
                     $page = new Page\Template\TitleDescMediaBlockSidebar();
                     $page->setTemplate('title_desc_media_block_sidebar_edito');
                     $page->setActive(true);
                 }
                 if ($lang != $defaultLang) {
                     $translationRepository->translate($page, 'name', $lang, $name);
                     $translationRepository->translate($page, 'title', $lang, $pageTitle);
                     $translationRepository->translate($page, 'description', $lang, $pageDescription);
                     $slug = Urlizer::transliterate(sprintf('%s Region hotelier %s', $brandId, $pageName));
                     $slug = Urlizer::urlize($slug);
                     if (function_exists('mb_strtolower')) {
                         $slug = mb_strtolower($slug);
                     } else {
                         $slug = strtolower($slug);
                     }
                     $translationRepository->translate($page, 'slug', $lang, $slug);
                 } else {
                     $page->setName($name);
                     $page->setTitle($pageTitle);
                     $page->setDescription($pageDescription);
                     $slug = Urlizer::transliterate(sprintf('%s Region hotelier %s', $brandId, $pageName));
                     $slug = Urlizer::urlize($slug);
                     if (function_exists('mb_strtolower')) {
                         $slug = mb_strtolower($slug);
                     } else {
                         $slug = strtolower($slug);
                     }
                     $page->setSlug($slug);
                 }
                 $em->persist($page);
                 for ($i = 1; $i < 6; $i++) {
                     $title = sprintf('block%sTitle', $i);
                     $desc = sprintf('block%sDescription', $i);
                     if (${$title} or ${$desc}) {
                         $blockName = sprintf('[%s] Region hotelier - %s - Bloc %s [%s]', $brandId, $pageName, $i, $regionId);
                         $block = $em->getRepository('BigfootContentBundle:Block\\Template\\TitleDescMedia')->createQueryBuilder('b')->where('b.name LIKE :name')->setParameter(':name', sprintf('%%%s [%s]%%', $i, $regionId))->getQuery()->setHint(\Gedmo\Translatable\TranslatableListener::HINT_TRANSLATABLE_LOCALE, 'en')->getOneOrNullResult();
                         if (!$block) {
                             $block = new TitleDescMedia();
                             $block->setTemplate('title_desc_media_editorialLeft');
                             $block->setActive(true);
                         }
                         if ($lang != $defaultLang) {
                             $translationRepository->translate($block, 'name', $lang, $blockName);
                             $translationRepository->translate($block, 'title', $lang, ${$title});
                             $translationRepository->translate($block, 'description', $lang, ${$desc});
                             $slug = Urlizer::transliterate($blockName);
                             $slug = Urlizer::urlize($slug);
                             if (function_exists('mb_strtolower')) {
                                 $slug = mb_strtolower($slug);
                             } else {
                                 $slug = strtolower($slug);
                             }
                             $translationRepository->translate($block, 'slug', $lang, $slug);
                         } else {
                             $block->setName($blockName);
                             $block->setTitle(${$title});
                             $block->setDescription(${$desc});
                             $pageBlock = new Page\Block();
                             $pageBlock->setBlock($block);
                             $pageBlock->setPage($page);
                             $pageBlock->setPosition($i);
                             $pageBlock->setTemplate('title_desc_media_editorialLeft');
                             $page->addBlock($pageBlock);
                             $em->persist($pageBlock);
                         }
                         $em->persist($block);
                     }
                 }
                 $em->flush();
             }
         }
     }
 }
 /**
  * Load data fixtures with the passed EntityManager
  *
  * @param ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $repository = $manager->getRepository('Gedmo\\Translatable\\Entity\\Translation');
     $page = new Page\Template\TitleDescMediaBlockSidebar();
     $page->setActive(true);
     $page->setTranslatableLocale('en');
     $page->setName('Formulaire d\'adhésion');
     $page->setSlug('membership-form');
     $page->setTitle('Membership form');
     $page->setDescription('');
     $page->setTemplate('title_desc_media_block_sidebar_form');
     $repository->translate($page, 'title', 'fr', 'Formulaire d\'adhésion');
     $manager->persist($page);
     // Block 1
     $block = new TitleDesc();
     $block->setTranslatableLocale('en');
     $block->setActive(true);
     $block->setName('[Formulaire d\'adhésion] Rejoignez le 1er Groupe Européen d\'Hôtellerie Indépendante');
     $block->setSlug('block-adhesion-form-1');
     $block->setTitle('Join Europe\'s Leading Independent Hotel Group');
     $block->setDescription('
     <h2 class="title3 lowerCase">Why should you join Europe\'s Leading Independent Hotel Group?</h2>
     <p>Because its cooperative society structure is made up entirely of independent hotel entrepreneurs like yourself.</p>
     <p>Because you can benefit from the strength of a brand and a network.</p>
     <p>Because you can market your hotel through all of the modern distribution channels, helping you to optimise your average price.</p>
     <p>Because SEH (Société Européenne d\'Hôtellerie) provides you with all of the services you expect from an effective name that belongs to you and enhances your business.</p>
     <p>Meet us to discuss your plans!</p>
     ');
     $block->setTemplate('title_desc_h2');
     $repository->translate($block, 'title', 'fr', 'Rejoignez le 1er Groupe Européen d\'Hôtellerie Indépendante');
     $repository->translate($block, 'description', 'fr', '
     <h2 class="title3 lowerCase">Pourquoi rejoindre le premier Groupe Européen d\'Hôtellerie Indépendante ?</h2>
     <p>Parce qu\'il se distingue par son organisation en société coopérative composée exclusivement d\'entrepreneurs hôteliers indépendants, comme vous.</p>
     <p>Parce qu\'il vous apporte la force d\'une marque et d\'un réseau.</p>
     <p>Parce qu\'il permet de commercialiser votre établissement sur tous les canaux de distribution modernes en vous aidant à optimiser votre prix moyen.</p>
     <p>Parce que la SEH (Société Européenne d’Hôtellerie) vous apporte tous les services que vous attendez d\'une enseigne efficace qui vous appartient et valorise votre fonds de commerce.</p>
     <p>Rencontrons-nous et parlons de votre projet !</p>
     ');
     $manager->persist($block);
     $pageBlock = new PageBlock();
     $pageBlock->setBlock($block);
     $pageBlock->setPage($page);
     $pageBlock->setPosition(0);
     $pageBlock->setTemplate('title_desc/title_desc_h2');
     $page->addBlock($pageBlock);
     // End Block 1
     // Block Formulaire d'adhésion
     $block = new TitleDesc();
     $block->setTranslatableLocale('en');
     $block->setActive(true);
     $block->setName('[Formulaire d\'adhésion] Votre établissement');
     $block->setSlug('block-adhesion-form-2');
     $block->setTitle('');
     $block->setDescription('');
     $block->setTemplate('title_desc_h2');
     $block->setAction('form_adhesion');
     $repository->translate($block, 'title', 'fr', '');
     $manager->persist($block);
     $pageBlock = new PageBlock();
     $pageBlock->setBlock($block);
     $pageBlock->setPage($page);
     $pageBlock->setPosition(1);
     $pageBlock->setTemplate('title_desc/title_desc_h2');
     $page->addBlock($pageBlock);
     // Fin Block Formulaire d'adhésion
     // Block 2
     $block = new TitleDesc();
     $block->setTranslatableLocale('en');
     $block->setActive(true);
     $block->setName('[Formulaire d\'adhésion] Quelques témoignages de nos hôteliers');
     $block->setSlug('block-adhesion-form-3');
     $block->setTitle('Testimonies from our hoteliers');
     $block->setDescription('
     <h2 class="title3 lowerCase">Miriam Vidali, Relais du Silence Albergo Casafrassi, Italy</h2>
     <p>"80% of our tourist guests are German and French. The stylish image of Relais du Silence is excellent for this type of guest and helps to bring in business. We noticed the results gradually, but now they are evident".</p>
     <h2 class="title3 lowerCase">Mr Claude Champfailly, Inter-Hotel Alizea – St Saturnin (Le Mans Nord - 72)</h2>
     <p>"The way the cooperative works in commercial terms is as effective as a franchise, but without the disadvantages and costs."</p>
     <h2 class="title3 lowerCase">Loïc Constant, Qualys-Hotel La Maison Rouge, Noeux les Mines (Lens - 62)</h2>
     <p>"With Qualys-Hotel we benefit from a high-end brand and the services of the SEH cooperative. Staying independent doesn\'t mean being alone."</p>
     <h2 class="title3 lowerCase">Philippe Merdy, Relais du Silence Les Costans, Perros-Guirec (22)</h2>
     <p>"I have found Relais du Silence to be a brand that is perfectly suited to my hotel and that has a strong positioning. It is a European network that gives real visibility on the international stage."</p>
     <h2 class="title3 lowerCase">Axelle Le Grix de la Salle, Ptit Dej-Hotel Mérignac (Bordeaux - 33)</h2>
     <p>"I wanted to join a national name with a powerful loyalty card, something we were missing by staying on our own. Ptit Dej-Hotel and the Accent card meet our expectations 100%."</p>
     ');
     $block->setTemplate('title_desc_h2');
     $repository->translate($block, 'title', 'fr', 'Quelques témoignages de nos hôteliers');
     $repository->translate($block, 'description', 'fr', '
     <h2 class="title3 lowerCase">Miriam Vidali Relais du Silence Albergo Casafrassi, Italie</h2>
     <p>« 80 % de nos clients tourisme sont Allemands et Français. L\'image raffinée des Relais du Silence est excellente pour cette clientèle et contribue à la bonne activité. L\'impact a été progressif, il est réel aujourd\'hui».</p>
     <h2 class="title3 lowerCase">Monsieur Claude Champfailly, Inter-Hotel Alizea – St Saturnin (Le Mans Nord - 72)</h2>
     <p>« Le fonctionnement de la coopérative sur le plan commercial, est aussi efficace que celui d\'une franchise, mais sans les inconvénients et les coûts de celle-ci». </p>
     <h2 class="title3 lowerCase">Loïc Constant, Qualys-Hotel La Maison Rouge à Noeux les Mines (Lens - 62)</h2>
     <p>« Qualys-Hotel nous permet de bénéficier d\'une marque haut de gamme et des services de la coopérative SEH. Rester indépendant mais ne pas rester seuls ». </p>
     <h2 class="title3 lowerCase">Philippe Merdy, Relais du Silence Les Costans à Perros–Guirec (22)</h2>
     <p>« J\'ai trouvé dans Relais du Silence une marque parfaitement adaptée à mon établissement, avec un positionnement fort. C\'est un réseau Européen qui donne une vraie visibilité sur l\'International ».</p>
     <h2 class="title3 lowerCase">Axelle Le Grix de la Salle, Ptit Dej-Hotel Mérignac (Bordeaux - 33)</h2>
     <p>« Je souhaitais rejoindre une enseigne nationale disposant d\'une carte de fidélité puissante qu\'il nous manquait en restant sans enseigne. Ptit Dej-Hotel et la carte Accent répondent parfaitement à nos attentes ».</p>
     ');
     $manager->persist($block);
     $pageBlock = new PageBlock();
     $pageBlock->setBlock($block);
     $pageBlock->setPage($page);
     $pageBlock->setPosition(2);
     $pageBlock->setTemplate('title_desc/title_desc_h2');
     $page->addBlock($pageBlock);
     // End Block 2
     $manager->flush();
 }