public function rebuildConfiguration(SiteInterface $site) { if ($site->getAliasOf()) { return $this; } foreach (array('vhost.apache.conf.twig', 'vhost.nginx.conf.twig', 'php.ini.twig', 'php-fpm.conf.twig') as $file) { $compiledFileName = preg_replace('/\\.twig$/', '', $file); $compiledFile = $this->getTemplateEngine()->render('SplicedCmsBundle:Config/site:' . $file, array('site' => $site)); file_put_contents($site->getRootDir() . '/conf/' . $compiledFileName, $compiledFile); } }
/** * update * * @param SiteInterface $site * @return mixed */ public function update(SiteInterface $site) { if (!$site->getId()) { return $this->save($site); } $this->getEntityManager()->persist($site); $this->getEntityManager()->flush(); $this->getEventDispatcher()->dispatch(SiteEvent::SITE_UPDATE, new SiteEvent($site)); }
public function findAllBySiteForJson(SiteInterface $site) { $query = $this->createQueryBuilder('m')->select('m')->where('m.site = :site')->setParameter('site', $site->getId()); return $query->getQuery()->getResult(Query::HYDRATE_ARRAY); }
/** * getGalleryQuery * * @param SiteInterface $site * @return QueryBuilder */ public function getGalleryQuery(SiteInterface $site) { $qb = $this->getEntityManager()->getRepository('SplicedCmsBundle:GalleryItem')->createQueryBuilder('g')->select('g, s')->leftJoin('g.site', 's')->where('g.site = :site')->setParameter('site', $site->getId()); return $qb; }
/** * buildTemplatePath * * Returns the full path used by the template engine * to render the actual content of the template, or to * be used in template file management. * * @access public * @param Template $template * @return string */ public function buildTemplatePath(TemplateInterface $template, SiteInterface $site) { return sprintf('@%s/%s', $site->getDomain(), $template->getFilename()); }