Commit ce7a1dff authored by Clouard Regis's avatar Clouard Regis
Browse files

Revised Repository

parent 181bcf6a
security:
encoders:
password_hashers:
App\Entity\User:
algorithm: auto
......
......@@ -8,13 +8,15 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Contracts\Translation\TranslatorInterface;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
use App\Form\PlannerType;
use App\Entity\User;
use App\Model\CreateUser;
// TODO
class AdminController extends AbstractController
{
/**
......
......@@ -14,11 +14,8 @@ class ChangeLocaleController extends AbstractController
*/
public function changeLocale($locale, Request $request): RedirectResponse
{
$newUrl = explode('/', $request->headers->get('referer'));
$prefixToBeRemoved = ($request->getLocale() === "fr") ? 0 : 1;
if ($locale === "fr") {
array_splice($newUrl, 3, $prefixToBeRemoved);
} else {
......@@ -28,5 +25,4 @@ class ChangeLocaleController extends AbstractController
return $this->redirect($newUrl);
}
}
<?php
namespace App\Controller;
use Swift_Mailer;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use App\Entity\User;
use App\Model\CreateUser;
class ControllerIndex extends AbstractController // TODO Used ?
class ControllerIndex extends AbstractController
{
/**
* @Route("/", name="home")
*/
public function index()
public function index(): Response
{
return $this->render('home/index.html.twig');
}
// /**
// * @Route("/test")
// */
// public function test()
// {
// phpinfo();
// }
//
// /**
// * @Route("/init")
// */
// public function init(UserPasswordEncoderInterface $encoder, Swift_Mailer $mailer)
// {
// $user = new User();
// $user->setUsername("eric");
//
// $user->setEmail("mfmyradrian@gmail.com");
// $user->setRoles(["ROLE_ADMIN"]);
//
// $creator = new CreateUser($user, null);
// $creator->addUser($encoder, $this->getDoctrine()->getManager());
// $creator->sendEmail($mailer, true);
//
// return $this->render(
// 'profile/index.html.twig',
// [
// 'user' => $user,
// ]
// );
// }
}
......@@ -17,6 +17,7 @@ use App\Form\GpxImportType;
use App\Entity\User;
use function simplexml_load_string;
// TODO
class CourseController extends AbstractController
{
const MAX_DISTANCE_IN_METERS = 100_000;
......@@ -78,6 +79,9 @@ class CourseController extends AbstractController
public function tracks($id, TrackStatistics $statistics, Request $request): Response
{
$course = $this->getDoctrine()->getRepository(Course::class)->find($id);
if (!$course) { // TODO Warning
throw $this->createNotFoundException("Ce parcours n'existe pas : ".$id);
}
$courseDate = $course->getStartDate();
if ($courseDate !== null) {
$dateDiff = $courseDate->diff(new DateTime('NOW'));
......@@ -94,9 +98,6 @@ class CourseController extends AbstractController
}
$importTab = 0;
$success = "";
if (!$course) { // TODO Warning
throw $this->createNotFoundException("Ce parcours n'existe pas : ".$id);
}
$xml = $course->getXml();
$simplexml = simplexml_load_string($xml);
$lengths = $statistics->computeLegLengths($simplexml);
......
......@@ -3,8 +3,6 @@
namespace App\Controller;
use App\Entity\Event;
use App\Entity\EventCourse;
use App\Entity\Participant;
use App\Entity\ParticipantMakeEventCourse;
use App\Entity\Track;
use PHPUnit\Util\Exception;
......@@ -20,6 +18,7 @@ use App\Model\CreateTrack;
use App\Model\CreateMissingControlPoint;
use function dirname;
// TODO
class DataController extends AbstractController
{
/**
......
......@@ -25,6 +25,7 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Security;
// TODO
class EventController extends AbstractController
{
private Security $security;
......
......@@ -23,6 +23,7 @@ use App\Model\FileUploader;
use function in_array;
use function simplexml_load_string;
// TODO
class PlannerController extends AbstractController
{
private Security $security;
......
......@@ -15,6 +15,7 @@ use App\Entity\User;
use App\Model\CreateUser;
use function in_array;
// TODO
class ProfileController extends AbstractController
{
private Security $security;
......
......@@ -16,6 +16,8 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use App\Entity\User;
use App\Model\CreateUser;
// TODO
class SecurityController extends AbstractController
{
/**
......
......@@ -7,6 +7,7 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
// TODO
class CourseFixtures extends Fixture implements DependentFixtureInterface
{
public const LUC_COURSE_REFERENCE = 'course_luc';
......
......@@ -7,6 +7,7 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
// TODO
class EventCourseFixtures extends Fixture implements DependentFixtureInterface
{
public const LUC_CHAMPIONSHIP_EVENTCOURSE_REFERENCE = 'Luc_championship_EventCourse';
......
......@@ -7,6 +7,7 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
// TODO
class EventFixtures extends Fixture implements DependentFixtureInterface
{
public const Championship_EVENT_REFERENCE = 'event_championship';
......
......@@ -7,6 +7,7 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
// TODO
class ParticipantFixtures extends Fixture implements DependentFixtureInterface
{
public const SULIAC_Championship_Participant_REFERENCE = 'Suliac_championship_participant';
......
......@@ -7,6 +7,7 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
// TODO
class ParticipantMakeEventCourseFixtures extends Fixture implements DependentFixtureInterface
{
public function load(ObjectManager $manager)
......
......@@ -7,6 +7,7 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
 
// TODO
class TrackFixtures extends Fixture implements DependentFixtureInterface
{
public const SULIAC_AUBIN_TRACK_REFERENCE = 'suliac_aubin_track';
......@@ -7,6 +7,7 @@ use Doctrine\Persistence\ObjectManager;
use App\Entity\User;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
// TODO
class UserFixtures extends Fixture
{
private $encoder;
......
......@@ -11,6 +11,7 @@ use App\Model\CourseValidator;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\Intl\Exception\BadMethodCallException;
// TODO
/**
* @ORM\Entity(repositoryClass="App\Repository\CourseRepository")
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment