Hi all, Tucking into Symfony2 and playing with a few things. However, if you check out the Doctrine guide http://symfony-reloaded.org/guides/Doctrine To use the dbal, after defining a connection in config.yml you call; $conn = $this->container->getDatabaseConnection();
Then can use $conn to run queries. If I do this I get; Call to undefined method helloDevDebugProjectContainer::getDatabaseConnection. Thrown by the DI container. If I call it directly from the DoctrineController it works, but of course is then direct and not via DI. Full Controller code here, with the working connection commented for reference. Help/ideas appreciated. <?php namespace Application\HelloBundle\Controller; use Symfony\Framework\DoctrineBundle\Controller\DoctrineController as Controller; class HelloController extends Controller { public function indexAction($name) { //$conn = DoctrineController::getDatabaseConnection(); $conn = $this->container->getDatabaseConnection(); $users = $conn->fetchAll('SELECT * FROM users'); return $this->render('HelloBundle:Hello:index', array('users' => $users)); } } -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en