Esempio n. 1
0
 /**
  * Function to load data
  *
  * @param \Doctrine\Common\Persistence\ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     // get default language from config
     $defaultLang = $this->container->getParameter('locale');
     $entityLang = new Language();
     $entityLang->setName(ucfirst($defaultLang));
     $entityLang->setLangKey($defaultLang);
     $entityLang->setIsDefault(1);
     $manager->persist($entityLang);
     $manager->flush();
 }
Esempio n. 2
0
 public function hasLanguage(Language $language)
 {
     $result = false;
     if (count($this->article_languages->toArray()) > 0) {
         foreach ($this->article_languages as $plTemp) {
             if ($language->getId() == $plTemp->getLanguage()->getId()) {
                 $result = true;
                 break;
             }
         }
     }
     return $result;
 }
Esempio n. 3
0
 /**
  * find pageLanguage with the page is showreel
  *
  * @param \CMS\Bundle\AdminBundle\Entity\Language $language the language
  *
  * @return type
  */
 public function findShowreel(\CMS\Bundle\AdminBundle\Entity\Language $language)
 {
     $qb = $this->createQueryBuilder('pl')->join('pl.page', 'p')->where('p.is_showreel=:active')->andWhere('pl.language=:langId')->setParameter('active', 1)->setParameter('langId', $language->getId());
     return $qb->getQuery()->getResult();
 }