/** * @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->setDomain($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); $code = isset($matches[1]) ? $matches[1] : $this->baseCode; if (!$context->hasParameter('code')) { $context->setParameter('code', $code); } if ($this->baseCode == $code) { $site = new Convention(); $site->setDomain('ritsi'); $this->siteManager->setCurrentSite($site); return; } $site = $this->em->getRepository('AppBundle:Convention')->findOneBy(array('domain' => $code)); if (!$site) { throw new NotFoundHttpException(sprintf('No site for code "%s"', $code)); } $this->siteManager->setCurrentSite($site); }