summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Coevoet <stof@notk.org>2012-06-27 23:15:24 +0200
committerChristophe Coevoet <stof@notk.org>2012-06-27 23:15:24 +0200
commita1b0936dcf1cd83587db30369614b647844decd3 (patch)
treec5b9cb4a872c5cdf4182ff91f549be8f15a250c2
parentc0284ae66dc57a0b9d75aef1b5788870c2d8c07e (diff)
Fixed some CS
-rw-r--r--src/Tolkiendil/GameBundle/Controller/AnagramController.php5
-rw-r--r--src/Tolkiendil/GameBundle/Controller/HangmanController.php6
-rw-r--r--src/Tolkiendil/GameBundle/Controller/QuizController.php16
-rw-r--r--src/Tolkiendil/GameBundle/Controller/WordSearchController.php9
-rw-r--r--src/Tolkiendil/GameBundle/IrcQuiz/Dumper.php1
-rw-r--r--src/Tolkiendil/MainBundle/Security/Provider/MybbProvider.php6
-rw-r--r--src/Tolkiendil/PartnerBundle/Controller/BookController.php9
7 files changed, 28 insertions, 24 deletions
diff --git a/src/Tolkiendil/GameBundle/Controller/AnagramController.php b/src/Tolkiendil/GameBundle/Controller/AnagramController.php
index 9652be9..4338f7c 100644
--- a/src/Tolkiendil/GameBundle/Controller/AnagramController.php
+++ b/src/Tolkiendil/GameBundle/Controller/AnagramController.php
@@ -10,12 +10,11 @@ class AnagramController extends Controller
{
public function showAction()
{
- $em = $this->get('doctrine.orm.entity_manager');
- $repo = $em->getRepository('Tolkiendil\\GameBundle\\Entity\\Word');
+ $doctrine = $this->getDoctrine();
/* @var $repo \Tolkiendil\GameBundle\Repository\WordRepository */
+ $repo = $doctrine->getRepository('Tolkiendil\\GameBundle\\Entity\\Word');
try {
$word = $repo->getRandomWithIndications();
- /* @var $word \Tolkiendil\GameBundle\Entity\Word */
} catch (NoResultException $e) {
throw new NotFoundHttpException('There is no word', $e);
}
diff --git a/src/Tolkiendil/GameBundle/Controller/HangmanController.php b/src/Tolkiendil/GameBundle/Controller/HangmanController.php
index 8c39d7f..71f785e 100644
--- a/src/Tolkiendil/GameBundle/Controller/HangmanController.php
+++ b/src/Tolkiendil/GameBundle/Controller/HangmanController.php
@@ -10,11 +10,11 @@ class HangmanController extends Controller
{
public function showAction()
{
- $em = $this->get('doctrine.orm.entity_manager');
- $repo = $em->getRepository('Tolkiendil\\GameBundle\\Entity\\Word');
+ $doctrine = $this->getDoctrine();
+ /** @var $repo \Tolkiendil\GameBundle\Repository\WordRepository */
+ $repo = $doctrine->getRepository('Tolkiendil\\GameBundle\\Entity\\Word');
try {
$word = $repo->getRandom();
- /* @var $word \Tolkiendil\GameBundle\Entity\Word */
} catch (NoResultException $e) {
throw new NotFoundHttpException('There is no word', $e);
}
diff --git a/src/Tolkiendil/GameBundle/Controller/QuizController.php b/src/Tolkiendil/GameBundle/Controller/QuizController.php
index ba578e5..c665234 100644
--- a/src/Tolkiendil/GameBundle/Controller/QuizController.php
+++ b/src/Tolkiendil/GameBundle/Controller/QuizController.php
@@ -2,26 +2,28 @@
namespace Tolkiendil\GameBundle\Controller;
+use Doctrine\ORM\NoResultException;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use Doctrine\ORM\NoResultException;
+use Symfony\Component\HttpFoundation\Request;
class QuizController extends Controller
{
- public function showAction($id)
+ public function showAction(Request $request, $id)
{
- $em = $this->get('doctrine.orm.entity_manager');
- $repo = $em->getRepository('Tolkiendil\\GameBundle\\Entity\\Quiz');
+ $doctrine = $this->getDoctrine();
+ /** @var $repo \Tolkiendil\GameBundle\Repository\QuizRepository */
+ $repo = $doctrine->getRepository('Tolkiendil\\GameBundle\\Entity\\Quiz');
try {
$quiz = $repo->findOneById($id);
- /* @var $quiz \Tolkiendil\GameBundle\Entity\Quiz */
} catch (NoResultException $e) {
throw new NotFoundHttpException(sprintf('The quiz with id "%d" does not exist', $id), $e);
}
+
+ /** @var $form \Symfony\Component\Form\Form */
$form = $this->get('form.factory')->createNamed('tolkiendil_game_quiz', 'quiz', null, array ('quiz' => $quiz));
- $request = $this->get('request');
- if ('POST' == $request->getMethod()) {
+ if ('POST' === $request->getMethod()) {
$form->bindRequest($request);
if ($form->isValid()) {
return $this->render('TolkiendilGameBundle:Quiz:check.html.twig', array ('quiz' => $quiz));
diff --git a/src/Tolkiendil/GameBundle/Controller/WordSearchController.php b/src/Tolkiendil/GameBundle/Controller/WordSearchController.php
index 928ca1f..a35dd80 100644
--- a/src/Tolkiendil/GameBundle/Controller/WordSearchController.php
+++ b/src/Tolkiendil/GameBundle/Controller/WordSearchController.php
@@ -4,19 +4,20 @@ namespace Tolkiendil\GameBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class WordSearchController extends Controller
{
- public function showAction($id)
+ public function showAction(Request $request, $id)
{
- $em = $this->get('doctrine.orm.entity_manager');
- $wordSearch = $em->find('Tolkiendil\\GameBundle\\Entity\\WordSearch', $id);
+ $doctrine = $this->getDoctrine();
+ $wordSearch = $doctrine->getManager()->find('Tolkiendil\\GameBundle\\Entity\\WordSearch', $id);
/* @var $wordSearch \Tolkiendil\GameBundle\Entity\WordSearch */
if (null === $wordSearch) {
throw new NotFoundHttpException(sprintf('The word search with id "%d" does not exist', $id));
}
- $request = $this->container->get('request');
+
$response = new Response();
$response->setLastModified($wordSearch->getUpdatedAt());
if ($response->isNotModified($request)) {
diff --git a/src/Tolkiendil/GameBundle/IrcQuiz/Dumper.php b/src/Tolkiendil/GameBundle/IrcQuiz/Dumper.php
index ee09ef4..f92eb53 100644
--- a/src/Tolkiendil/GameBundle/IrcQuiz/Dumper.php
+++ b/src/Tolkiendil/GameBundle/IrcQuiz/Dumper.php
@@ -18,7 +18,6 @@ class Dumper
public function dump()
{
- /** @var $repository \Doctrine\ORM\EntityRepository */
$repository = $this->registry->getRepository('TolkiendilGameBundle:IrcQuestion');
/** @var $questions \Tolkiendil\GameBundle\Entity\IrcQuestion[] */
diff --git a/src/Tolkiendil/MainBundle/Security/Provider/MybbProvider.php b/src/Tolkiendil/MainBundle/Security/Provider/MybbProvider.php
index 48c93c1..38517ce 100644
--- a/src/Tolkiendil/MainBundle/Security/Provider/MybbProvider.php
+++ b/src/Tolkiendil/MainBundle/Security/Provider/MybbProvider.php
@@ -2,12 +2,12 @@
namespace Tolkiendil\MainBundle\Security\Provider;
+use Doctrine\DBAL\Connection;
use Symfony\Component\Security\Core\User\UserProviderInterface;
-use Tolkiendil\MainBundle\Security\User\MybbUser;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
-use Doctrine\DBAL\Connection;
+use Tolkiendil\MainBundle\Security\User\MybbUser;
/**
* MybbProvider
@@ -15,7 +15,7 @@ use Doctrine\DBAL\Connection;
class MybbProvider implements UserProviderInterface
{
/**
- * @var Doctrine\DBAL\Connection
+ * @var Connection
*/
private $connection;
private $tablePrefix;
diff --git a/src/Tolkiendil/PartnerBundle/Controller/BookController.php b/src/Tolkiendil/PartnerBundle/Controller/BookController.php
index ed24288..a8c35c3 100644
--- a/src/Tolkiendil/PartnerBundle/Controller/BookController.php
+++ b/src/Tolkiendil/PartnerBundle/Controller/BookController.php
@@ -8,7 +8,8 @@ class BookController extends Controller
{
public function listRestrictAuthorAction($language, $author_id)
{
- $bookRepo = $this->get('doctrine.orm.entity_manager')->getRepository('Tolkiendil\\PartnerBundle\\Entity\\Book');
+ /** @var $bookRepo \Tolkiendil\PartnerBundle\Repository\BookRepository */
+ $bookRepo = $this->getDoctrine()->getRepository('Tolkiendil\\PartnerBundle\\Entity\\Book');
$books = $bookRepo->findByLanguageAndAuthor($language, $author_id);
return $this->render('TolkiendilPartnerBundle:Book:list.html.twig', compact('books'));
@@ -16,7 +17,8 @@ class BookController extends Controller
public function listExcludeAuthorAction($language, $author_id)
{
- $bookRepo = $this->get('doctrine.orm.entity_manager')->getRepository('Tolkiendil\\PartnerBundle\\Entity\\Book');
+ /** @var $bookRepo \Tolkiendil\PartnerBundle\Repository\BookRepository */
+ $bookRepo = $this->getDoctrine()->getRepository('Tolkiendil\\PartnerBundle\\Entity\\Book');
$books = $bookRepo->findByLanguageAndNotAuthor($language, $author_id);
return $this->render('TolkiendilPartnerBundle:Book:list.html.twig', compact('books'));
@@ -24,7 +26,8 @@ class BookController extends Controller
public function listRestrictWorkAction($language, $work_id)
{
- $bookRepo = $this->get('doctrine.orm.entity_manager')->getRepository('Tolkiendil\\PartnerBundle\\Entity\\Book');
+ /** @var $bookRepo \Tolkiendil\PartnerBundle\Repository\BookRepository */
+ $bookRepo = $this->getDoctrine()->getRepository('Tolkiendil\\PartnerBundle\\Entity\\Book');
$books = $bookRepo->findByLanguageAndWork($language, $work_id);
return $this->render('TolkiendilPartnerBundle:Book:list.html.twig', compact('books'));