Skip to content

Commit

Permalink
L'utilisateur connecté est enregistré comme créateur lors qu'il créée…
Browse files Browse the repository at this point in the history
… une entité.
  • Loading branch information
Parmifer committed Jun 25, 2017
1 parent e084665 commit 90d1e02
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
10 changes: 6 additions & 4 deletions src/AppBundle/Controller/AnnonceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
use AppBundle\Entity\Annonce;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;

/**
* Annonce controller.
Expand Down Expand Up @@ -54,9 +56,9 @@ public function nouveauAction(Request $request)
$form->handleRequest($request);

$annonce->setDateCreation(new \DateTime());
// TODO:
// Remplacer l'id 2 par l'id de l'utilisateur connecté
$createur = $em->getRepository('AppBundle:Utilisateur')->find(2);

$session = new Session();
$createur = $session->get('utilisateur');
$annonce->setCreateur($createur);

if ($form->isSubmitted() && $form->isValid()) {
Expand Down
10 changes: 6 additions & 4 deletions src/AppBundle/Controller/ApplicationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
use AppBundle\Entity\Application;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;

/**
* Application controller.
Expand Down Expand Up @@ -65,9 +67,9 @@ public function nouveauAction(Request $request)
$form->handleRequest($request);

$application->setDateCreation(new \DateTime());
// TODO:
// Remplacer l'id 2 par l'id de l'utilisateur connecté
$createur = $em->getRepository('AppBundle:Utilisateur')->find(2);

$session = new Session();
$createur = $session->get('utilisateur');
$application->setCreateur($createur);

if ($form->isSubmitted() && $form->isValid()) {
Expand Down
6 changes: 3 additions & 3 deletions src/AppBundle/Controller/EvenementController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public function nouveauAction(Request $request)
$form->handleRequest($request);

$evenement->setDateCreation(new \DateTime());
// TODO:
// Remplacer l'id 2 par l'id de l'utilisateur connecté
$createur = $em->getRepository('AppBundle:Utilisateur')->find(2);

$session = new Session();
$createur = $session->get('utilisateur');
$evenement->setCreateur($createur);

if ($form->isSubmitted() && $form->isValid()) {
Expand Down
2 changes: 2 additions & 0 deletions src/AppBundle/Controller/MainController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public function indexAction(Request $request)
$session = new Session();
$em = $this->getDoctrine()->getManager();

// TODO : Faire la même chose pour les annonces que pour les évents
$annonces = $em->getRepository('AppBundle:Annonce')->findPublicatedOnes();

if ($session->get('estConnecte'))
{
$evenements = $em->getRepository('AppBundle:Evenement')->findComingOnes();
Expand Down
10 changes: 6 additions & 4 deletions src/AppBundle/Controller/NotificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
use AppBundle\Entity\Notification;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;

/**
* Notification controller.
Expand Down Expand Up @@ -57,9 +59,9 @@ public function nouveauAction(Request $request)
$form->handleRequest($request);

$notification->setDateCreation(new \DateTime());
// TODO:
// Remplacer l'id 2 par l'id de l'utilisateur connecté
$createur = $em->getRepository('AppBundle:Utilisateur')->find(2);

$session = new Session();
$createur = $session->get('utilisateur');
$notification->setCreateur($createur);

if ($form->isSubmitted() && $form->isValid()) {
Expand Down

0 comments on commit 90d1e02

Please sign in to comment.