Skip to content

Instantly share code, notes, and snippets.

@codecowboy
Created October 3, 2011 12:24
Show Gist options
  • Save codecowboy/1258990 to your computer and use it in GitHub Desktop.
Save codecowboy/1258990 to your computer and use it in GitHub Desktop.
controller
<?php
namespace Gymloop\ChallengeBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Gymloop\CoreBundle\Entity\Challenge;
use Gymloop\CoreBundle\Entity\ChallengeCoordinates;
class DefaultController extends Controller
{
public function indexAction()
{
$user = $user = $this->get('security.context')->getToken()->getUser();
$challenge = $this->getDoctrine()
->getRepository('GymloopCoreBundle:Challenge')
->find(1);
if(!$challenge) {
throw $this->createNotFoundException('No challenge found');
}
$coordinates = $challenge->getCoordinates();
return $this->render('GymloopChallengeBundle:Default:index.html.twig', array('challenge' => $challenge, 'coordinates'=> $coordinates->toArray()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment