Fixed deprecation warning messages

This commit is contained in:
Gergely Polonkai 2013-02-26 20:40:19 +01:00
parent 919d35d082
commit cfc8622a5f
11 changed files with 65 additions and 29 deletions

View File

@ -36,7 +36,12 @@ class DefaultController extends Controller
throw new AccessDeniedException('Ehhez a művelethez nincs jogosultságod.');
}
$users = $this->getDoctrine()->getEntityManager()->createQuery('SELECT u FROM KekRozsakSecurityBundle:User u WHERE u.acceptedBy IS NULL')->getResult();
$users = $this
->getDoctrine()
->getManager()
->createQuery('SELECT u FROM KekRozsakSecurityBundle:User u WHERE u.acceptedBy IS NULL')
->getResult()
;
$request = $this->getRequest();
if ($request->getMethod() == 'POST') {
@ -44,7 +49,7 @@ class DefaultController extends Controller
if (($user = $this->getDoctrine()->getRepository('KekRozsakSecurityBundle:User')->findOneById($userid)) != null) {
$activeUser = $this->$securityContext->getToken()->getUser();
$user->setAcceptedBy($activeUser);
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($user);
$em->flush();
@ -91,7 +96,7 @@ class DefaultController extends Controller
$membershipObject->setMembershipAcceptedAt(new \DateTime('now'));
$membershipObject->setMembershipAcceptedBy($user);
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($membershipObject);
$em->flush();

View File

@ -18,7 +18,7 @@ class BlogController extends Controller
{
$query = $this
->getDoctrine()
->getEntityManager()
->getManager()
->createQuery('
SELECT
p

View File

@ -20,7 +20,20 @@ class BookController extends Controller
*/
public function listAction()
{
$query = $this->getDoctrine()->getEntityManager()->createQuery('SELECT b FROM KekRozsakFrontBundle:Book b ORDER BY b.author ASC, b.title ASC, b.year ASC');
$query = $this
->getDoctrine()
->getManager()
->createQuery('
SELECT
b
FROM
KekRozsakFrontBundle:Book b
ORDER BY
b.author ASC,
b.title ASC,
b.year ASC
')
;
$books = $query->getResult();
@ -42,7 +55,7 @@ class BookController extends Controller
if ($request->getMethod() == 'POST') {
$newBookForm->bindRequest($request);
if ($newBookForm->isValid()) {
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($book);
$em->flush();
@ -87,7 +100,7 @@ class BookController extends Controller
public function ajaxDeleteBookAction(Book $book)
{
$copies = $book->getUsersCopies($this->get('security.context')->getToken()->getUser());
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$copies->forAll(function($key, $copy) use ($book, $em) {
$book->removeCopy($copy);
$em->remove($copy);
@ -110,7 +123,7 @@ class BookController extends Controller
$copies = $book->getUsersCopies($user);
if ($copies->count() == 0) {
$copy = new BookCopy($book, $user);
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($copy);
$em->flush();
}
@ -129,7 +142,7 @@ class BookController extends Controller
{
$user = $this->get('security.context')->getToken()->getUser();
$copies = $book->getUsersCopies($user);
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$copies->forAll(function($key, $copy) use ($em, $newValue) {
$copy->setBorrowable($newValue);
$em->persist($copy);
@ -150,7 +163,7 @@ class BookController extends Controller
{
$user = $this->get('security.context')->getToken()->getUser();
$copies = $book->getUsersCopies($user);
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$copies->forAll(function($key, $copy) use ($em, $newValue) {
$copy->setBuyable($newValue);
$em->persist($copy);
@ -177,7 +190,7 @@ class BookController extends Controller
$book->addWouldBorrow($user);
}
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($book);
$em->flush();

View File

@ -52,7 +52,7 @@ class DefaultController extends Controller
$user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt()));
}
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($user);
$em->flush();
}

View File

@ -60,7 +60,7 @@ class DocumentController extends Controller
$document->setCreatedAt(new \DateTime('now'));
$document->setCreatedBy($this->get('security.context')->getToken()->getUser());
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($document);
$em->flush();
@ -98,7 +98,7 @@ class DocumentController extends Controller
$document->setSlug($slugifier->slugify($document->getTitle()));
// TODO: add updatedAt, updatedBy, updateReason, etc.
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($document);
$em->flush();

View File

@ -57,7 +57,7 @@ class EventController extends Controller
$event->addAttendee($user);
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($event);
$em->flush();
@ -79,11 +79,11 @@ class EventController extends Controller
$realDate = null;
if ($date === null) {
$query = $this->getDoctrine()->getEntityManager()->createQuery('SELECT e FROM KekRozsakFrontBundle:Event e WHERE e.cancelled = FALSE AND (e.startDate >= :day OR (e.startDate <= :day AND e.endDate >= :day))');
$query = $this->getDoctrine()->getManager()->createQuery('SELECT e FROM KekRozsakFrontBundle:Event e WHERE e.cancelled = FALSE AND (e.startDate >= :day OR (e.startDate <= :day AND e.endDate >= :day))');
$query->setParameter('day', new \DateTime('now'), \Doctrine\DBAL\Types\Type::DATE);
} else {
$realDate = \DateTime::createFromFormat('Y-m-d', $date);
$query = $this->getDoctrine()->getEntityManager()->createQuery('SELECT e FROM KekRozsakFrontBundle:Event e WHERE e.cancelled = FALSE AND ((e.startDate < :day AND e.endDate >= :day) OR e.startDate = :day)');
$query = $this->getDoctrine()->getManager()->createQuery('SELECT e FROM KekRozsakFrontBundle:Event e WHERE e.cancelled = FALSE AND ((e.startDate < :day AND e.endDate >= :day) OR e.startDate = :day)');
$query->setParameter('day', $realDate, \Doctrine\DBAL\Types\Type::DATE);
}
$events = $query->getResult();
@ -104,7 +104,7 @@ class EventController extends Controller
*/
public function ajaxListAction(\DateTime $date)
{
$query = $this->getDoctrine()->getEntityManager()->createQuery('SELECT e FROM KekRozsakFrontBundle:Event e WHERE e.cancelled = FALSE AND ((e.startDate < :day AND e.endDate >= :day) OR e.startDate = :day)');
$query = $this->getDoctrine()->getManager()->createQuery('SELECT e FROM KekRozsakFrontBundle:Event e WHERE e.cancelled = FALSE AND ((e.startDate < :day AND e.endDate >= :day) OR e.startDate = :day)');
$query->setParameter('day', $date, \Doctrine\DBAL\Types\Type::DATE);
$events = $query->getResult();

View File

@ -45,7 +45,7 @@ class ForumController extends Controller
$newTopicGroup->setCreatedAt(new \DateTime('now'));
$newTopicGroup->setCreatedBy($this->get('security.context')->getToken()->getUser());
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($newTopicGroup);
$em->flush();
@ -91,7 +91,7 @@ class ForumController extends Controller
$newTopic->setCreatedBy($this->get('security.context')->getToken()->getUser());
$newTopic->setTopicGroup($topicGroup);
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($newTopic);
$em->flush();
@ -158,7 +158,7 @@ class ForumController extends Controller
$post->setCreatedBy($this->get('security.context')->getToken()->getUser());
$post->setTopic($topic);
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($post);
$em->persist($topic);
$em->flush();
@ -210,7 +210,7 @@ class ForumController extends Controller
}
$userData->addFavouriteTopic($topic);
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($userData);
$em->flush();
@ -244,7 +244,7 @@ class ForumController extends Controller
}
$userData->removeFavouriteTopic($topic);
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($userData);
$em->flush();

View File

@ -114,7 +114,7 @@ class GroupController extends Controller
$membership->setMembershipAcceptedAt(new \DateTime('now'));
}
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($membership);
$em->flush();
@ -160,7 +160,7 @@ class GroupController extends Controller
$group->setCreatedAt(new \DateTime('now'));
$group->setOpen(true);
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($group);
$em->flush();

View File

@ -43,7 +43,25 @@ class EventsExtension extends \Twig_Extension
* collection, adding each element to $monthEvents array's
* 'day'th element array.
*/
$query = $this->_doctrine->getEntityManager()->createQuery('SELECT e FROM KekRozsakFrontBundle:Event e WHERE e.cancelled = FALSE AND ((e.startDate < :firstDay AND e.endDate >= :firstDay) OR e.startDate BETWEEN :firstDay AND :lastDay)');
$query = $this->
_doctrine
->getManager()
->createQuery('
SELECT
e
FROM
KekRozsakFrontBundle:Event e
WHERE
e.cancelled = FALSE
AND (
(
e.startDate < :firstDay
AND e.endDate >= :firstDay
)
OR e.startDate BETWEEN :firstDay AND :lastDay
)
')
;
$query->setParameter('firstDay', $firstDay, \Doctrine\DBAL\Types\Type::DATE);
$query->setParameter('lastDay', $lastDay, \Doctrine\DBAL\Types\Type::DATE);
$events = $query->getResult();

View File

@ -93,7 +93,7 @@ class DefaultController extends Controller
$user->addRole($role);
}
$em = $this->getDoctrine()->getEntityManager();
$em = $this->getDoctrine()->getManager();
$em->persist($user);
$em->flush();

View File

@ -34,7 +34,7 @@ class AuthSuccess implements AuthenticationSuccessHandlerInterface
public function onSecurityAuthenticationSuccess(AuthenticationEvent $event)
{
$user = $event->getAuthenticationToken()->getUser();
$em = $this->doctrine->getEntityManager();
$em = $this->doctrine->getManager();
$user->setLastLoginAt(new \DateTime('now'));
$em->persist($user);
$em->flush();
@ -43,7 +43,7 @@ class AuthSuccess implements AuthenticationSuccessHandlerInterface
public function onAuthenticationSuccess(Request $request, TokenInterface $token)
{
$user = $token->getUser();
$em = $this->doctrine->getEntityManager();
$em = $this->doctrine->getManager();
$user->setLastLoginAt(new \DateTime('now'));
$em->persist($user);
$em->flush();