/** * @Given existen las asambleas: */ public function thereAreConventions(TableNode $tableNode) { foreach ($tableNode->getHash() as $conventionHash) { $convention = new Convention(); $convention->setName($conventionHash['nombre']); $convention->setStartsAt(new \DateTime($conventionHash['fechaInicio'])); $convention->setEndsAt(new \DateTime($conventionHash['fechaFin'])); $convention->setSlug($conventionHash['dominio']); $convention->setEmail($this->faker->email); $this->getEntityManager()->persist($convention); } $this->getEntityManager()->flush(); }
public function onKernelRequest(GetResponseEvent $event) { $context = $this->router->getContext(); preg_match('/^\\/convention\\/([a-z]\\w+)/', $context->getPathInfo(), $matches); $slug = isset($matches[1]) ? $matches[1] : $this->baseSlug; if (!$context->hasParameter('slug')) { $context->setParameter('slug', $slug); } if ($this->baseSlug == $slug) { $site = new Convention(); $site->setSlug('ritsi'); $this->siteManager->setCurrentSite($site); return; } $site = $this->em->getRepository('AppBundle:Convention')->findOneBy(array('slug' => $slug)); if (!$site) { throw new NotFoundHttpException(sprintf('No site for slug "%s"', $slug)); } $this->siteManager->setCurrentSite($site); }