diff --git a/migrations/Version20230329200327.php b/migrations/Version20230329200327.php deleted file mode 100644 index 897b3ae238915150cfbb0aecb0309fba31f15c49..0000000000000000000000000000000000000000 --- a/migrations/Version20230329200327.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace DoctrineMigrations; - -use Doctrine\DBAL\Schema\Schema; -use Doctrine\Migrations\AbstractMigration; - -/** - * Auto-generated Migration: Please modify to your needs! - */ -final class Version20230329200327 extends AbstractMigration -{ - public function getDescription(): string - { - return ''; - } - - public function up(Schema $schema): void - { - // this up() migration is auto-generated, please modify it to your needs - $this->addSql('CREATE TABLE ecurie (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, picture VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE pilotes (id INT AUTO_INCREMENT NOT NULL, ecurie_id INT NOT NULL, name VARCHAR(255) NOT NULL, picture VARCHAR(255) NOT NULL, INDEX IDX_E306533657F92A74 (ecurie_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('ALTER TABLE pilotes ADD CONSTRAINT FK_E306533657F92A74 FOREIGN KEY (ecurie_id) REFERENCES ecurie (id)'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE pilotes DROP FOREIGN KEY FK_E306533657F92A74'); - $this->addSql('DROP TABLE ecurie'); - $this->addSql('DROP TABLE pilotes'); - } -} diff --git a/migrations/Version20230329195906.php b/migrations/Version20230330065738.php similarity index 65% rename from migrations/Version20230329195906.php rename to migrations/Version20230330065738.php index e2cd127e894e0b1a061fccfff26fae82a083993e..305aa24e0eeb98f4a7fb228d5136d90da15bafa1 100644 --- a/migrations/Version20230329195906.php +++ b/migrations/Version20230330065738.php @@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration; /** * Auto-generated Migration: Please modify to your needs! */ -final class Version20230329195906 extends AbstractMigration +final class Version20230330065738 extends AbstractMigration { public function getDescription(): string { @@ -21,17 +21,21 @@ final class Version20230329195906 extends AbstractMigration { // this up() migration is auto-generated, please modify it to your needs $this->addSql('CREATE TABLE category (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE clothes (id INT AUTO_INCREMENT NOT NULL, category_id INT NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT NOT NULL, picture VARCHAR(255) NOT NULL, price DOUBLE PRECISION NOT NULL, INDEX IDX_3079B48C12469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE clothes (id INT AUTO_INCREMENT NOT NULL, category_id INT NOT NULL, ecurie_id INT NOT NULL, name VARCHAR(255) NOT NULL, picture VARCHAR(255) NOT NULL, price DOUBLE PRECISION NOT NULL, INDEX IDX_3079B48C12469DE2 (category_id), INDEX IDX_3079B48C57F92A74 (ecurie_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE ecurie (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, picture VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT NOT NULL, headers LONGTEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL, available_at DATETIME NOT NULL, delivered_at DATETIME DEFAULT NULL, INDEX IDX_75EA56E0FB7336F0 (queue_name), INDEX IDX_75EA56E0E3BD61CE (available_at), INDEX IDX_75EA56E016BA31DB (delivered_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('ALTER TABLE clothes ADD CONSTRAINT FK_3079B48C12469DE2 FOREIGN KEY (category_id) REFERENCES category (id)'); + $this->addSql('ALTER TABLE clothes ADD CONSTRAINT FK_3079B48C57F92A74 FOREIGN KEY (ecurie_id) REFERENCES ecurie (id)'); } public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->addSql('ALTER TABLE clothes DROP FOREIGN KEY FK_3079B48C12469DE2'); + $this->addSql('ALTER TABLE clothes DROP FOREIGN KEY FK_3079B48C57F92A74'); $this->addSql('DROP TABLE category'); $this->addSql('DROP TABLE clothes'); + $this->addSql('DROP TABLE ecurie'); $this->addSql('DROP TABLE messenger_messages'); } } diff --git a/public/img/clothes/mercdes/casquette_blanche.avif b/public/img/clothes/mercdes/casquette_blanche.avif new file mode 100644 index 0000000000000000000000000000000000000000..af23436e131df770b48ab92ba7a2435390ca2ba1 Binary files /dev/null and b/public/img/clothes/mercdes/casquette_blanche.avif differ diff --git a/public/img/clothes/mercdes/casquette_lewis_blacnhe.avif b/public/img/clothes/mercdes/casquette_lewis_blacnhe.avif new file mode 100644 index 0000000000000000000000000000000000000000..4137a9d7e06679c75349f8a558281a8b19eeb0dc Binary files /dev/null and b/public/img/clothes/mercdes/casquette_lewis_blacnhe.avif differ diff --git a/public/img/clothes/mercdes/casquette_lewis_bleue.avif b/public/img/clothes/mercdes/casquette_lewis_bleue.avif new file mode 100644 index 0000000000000000000000000000000000000000..1af8b5e5739dfc6d2d29074182bdb041f21fe3d7 Binary files /dev/null and b/public/img/clothes/mercdes/casquette_lewis_bleue.avif differ diff --git a/public/img/clothes/mercdes/casquette_lewis_noir.avif b/public/img/clothes/mercdes/casquette_lewis_noir.avif new file mode 100644 index 0000000000000000000000000000000000000000..d5958c6a0efb2f5a8cf1e2a06ba467366a87b868 Binary files /dev/null and b/public/img/clothes/mercdes/casquette_lewis_noir.avif differ diff --git a/public/img/clothes/mercdes/casquette_lewis_violet.avif b/public/img/clothes/mercdes/casquette_lewis_violet.avif new file mode 100644 index 0000000000000000000000000000000000000000..76dcc89756b01e6175a0b2914e12a7abff91ed1e Binary files /dev/null and b/public/img/clothes/mercdes/casquette_lewis_violet.avif differ diff --git a/public/img/clothes/mercdes/casquette_noir.avif b/public/img/clothes/mercdes/casquette_noir.avif new file mode 100644 index 0000000000000000000000000000000000000000..f0a18084df63fed134a1a171632a88a054e45263 Binary files /dev/null and b/public/img/clothes/mercdes/casquette_noir.avif differ diff --git a/public/img/clothes/mercdes/gilet_noir.avif b/public/img/clothes/mercdes/gilet_noir.avif new file mode 100644 index 0000000000000000000000000000000000000000..a50a831ac0efae28d5f767f937d554001071dc03 Binary files /dev/null and b/public/img/clothes/mercdes/gilet_noir.avif differ diff --git a/public/img/clothes/mercdes/maillot_f1_23_blanc.avif b/public/img/clothes/mercdes/maillot_f1_23_blanc.avif new file mode 100644 index 0000000000000000000000000000000000000000..fefd28168863031d29b8bc2cd37e1bed503eab45 Binary files /dev/null and b/public/img/clothes/mercdes/maillot_f1_23_blanc.avif differ diff --git a/public/img/clothes/mercdes/polo_f1_23_blanc.avif b/public/img/clothes/mercdes/polo_f1_23_blanc.avif new file mode 100644 index 0000000000000000000000000000000000000000..8a9a6f3da8791521a612be9adc3c3535cb141086 Binary files /dev/null and b/public/img/clothes/mercdes/polo_f1_23_blanc.avif differ diff --git a/public/img/clothes/mercdes/polo_f1_23_noir.webp b/public/img/clothes/mercdes/polo_f1_23_noir.webp new file mode 100644 index 0000000000000000000000000000000000000000..f1696d66867cdb9de57a34c81b598b656aad3b5e Binary files /dev/null and b/public/img/clothes/mercdes/polo_f1_23_noir.webp differ diff --git a/public/img/clothes/mercdes/pull_f1_23_noir.avif b/public/img/clothes/mercdes/pull_f1_23_noir.avif new file mode 100644 index 0000000000000000000000000000000000000000..706056b3be3271faef882b023fba3d7f2ace684e Binary files /dev/null and b/public/img/clothes/mercdes/pull_f1_23_noir.avif differ diff --git a/public/img/clothes/mercdes/sweet_a_capuche_noir.avif b/public/img/clothes/mercdes/sweet_a_capuche_noir.avif new file mode 100644 index 0000000000000000000000000000000000000000..7c5b65cb511bbb16f5b8210e137cab4ec65f9df8 Binary files /dev/null and b/public/img/clothes/mercdes/sweet_a_capuche_noir.avif differ diff --git a/public/img/clothes/mercdes/sweet_a_capuche_noir2.avif b/public/img/clothes/mercdes/sweet_a_capuche_noir2.avif new file mode 100644 index 0000000000000000000000000000000000000000..f213553816a5c8f9b9a0ae1d28dff1390d63759a Binary files /dev/null and b/public/img/clothes/mercdes/sweet_a_capuche_noir2.avif differ diff --git a/public/img/clothes/mercdes/tshirt_f1_22_noir.webp b/public/img/clothes/mercdes/tshirt_f1_22_noir.webp new file mode 100644 index 0000000000000000000000000000000000000000..251011ca923ab4e764186331563f775f3d737232 Binary files /dev/null and b/public/img/clothes/mercdes/tshirt_f1_22_noir.webp differ diff --git a/public/img/clothes/mercdes/tshirt_f1_23_blanc.avif b/public/img/clothes/mercdes/tshirt_f1_23_blanc.avif new file mode 100644 index 0000000000000000000000000000000000000000..27299f2b0697b9b36000e3274e18637024318961 Binary files /dev/null and b/public/img/clothes/mercdes/tshirt_f1_23_blanc.avif differ diff --git a/public/img/clothes/mercdes/tshirt_f1_23_noir.avif b/public/img/clothes/mercdes/tshirt_f1_23_noir.avif new file mode 100644 index 0000000000000000000000000000000000000000..e7bbdf634438773c81dcc0613b2a3c4b8a258841 Binary files /dev/null and b/public/img/clothes/mercdes/tshirt_f1_23_noir.avif differ diff --git a/public/img/clothes/mercdes/tshirt_vert.avif b/public/img/clothes/mercdes/tshirt_vert.avif new file mode 100644 index 0000000000000000000000000000000000000000..4310a62634c96fd0b2ef711e7b6f5e812520abbd Binary files /dev/null and b/public/img/clothes/mercdes/tshirt_vert.avif differ diff --git a/public/img/clothes/mercdes/veste.avif b/public/img/clothes/mercdes/veste.avif new file mode 100644 index 0000000000000000000000000000000000000000..63f892292ba0dddf7e5bd57bafca620bde42d71e Binary files /dev/null and b/public/img/clothes/mercdes/veste.avif differ diff --git a/public/img/clothes/mercdes/veste_f1_23_noir.avif b/public/img/clothes/mercdes/veste_f1_23_noir.avif new file mode 100644 index 0000000000000000000000000000000000000000..886c149e11984b22df81c64e360ad41d3f06e8d5 Binary files /dev/null and b/public/img/clothes/mercdes/veste_f1_23_noir.avif differ diff --git a/src/Controller/StaticPages.php b/src/Controller/StaticPages.php index 02f6d2b93fc68c63799f797fa3ee29da5e762d06..c3576ab6b2fb60c40024a7f461b0c3aa613324ca 100644 --- a/src/Controller/StaticPages.php +++ b/src/Controller/StaticPages.php @@ -1,6 +1,13 @@ <?php namespace App\Controller; + + +use App\Entity\Ecurie; +use App\Form\EcurieType; +use App\Repository\EcurieRepository; + + use Symfony\Component\HttpFoundation\Response; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Routing\Annotation\Route; @@ -12,10 +19,13 @@ class StaticPages extends AbstractController */ public function home(): Response { + $ecurieRepository = $this->getDoctrine() + ->getRepository(Ecurie::class); $titre = 'Bienvenue'; return $this->render('home.html.twig', [ - 'titre' => $titre + 'titre' => $titre, + 'ecuries' => $ecurieRepository->findAll(), ]); } } \ No newline at end of file diff --git a/src/Entity/Clothes.php b/src/Entity/Clothes.php index 00af1fcf56950076c403368e15666aeafd6a6fc1..633c4ff883566b0cd9f467e4bd2042360d3d7d7b 100644 --- a/src/Entity/Clothes.php +++ b/src/Entity/Clothes.php @@ -3,7 +3,6 @@ namespace App\Entity; use App\Repository\ClothesRepository; -use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity(repositoryClass: ClothesRepository::class)] @@ -17,9 +16,6 @@ class Clothes #[ORM\Column(length: 255)] private ?string $name = null; - #[ORM\Column(type: Types::TEXT)] - private ?string $description = null; - #[ORM\Column(length: 255)] private ?string $picture = null; @@ -30,6 +26,10 @@ class Clothes #[ORM\JoinColumn(nullable: false)] private ?Category $category = null; + #[ORM\ManyToOne(inversedBy: 'clothes')] + #[ORM\JoinColumn(nullable: false)] + private ?Ecurie $ecurie = null; + public function getId(): ?int { return $this->id; @@ -47,18 +47,6 @@ class Clothes return $this; } - public function getDescription(): ?string - { - return $this->description; - } - - public function setDescription(string $description): self - { - $this->description = $description; - - return $this; - } - public function getPicture(): ?string { return $this->picture; @@ -94,4 +82,16 @@ class Clothes return $this; } + + public function getEcurie(): ?Ecurie + { + return $this->ecurie; + } + + public function setEcurie(?Ecurie $ecurie): self + { + $this->ecurie = $ecurie; + + return $this; + } } diff --git a/src/Entity/Ecurie.php b/src/Entity/Ecurie.php index 672b5110789ebe52450dd0c07a34aa71a1eb15e4..fa108412c9c06ea373a4da05032c904c420cb919 100644 --- a/src/Entity/Ecurie.php +++ b/src/Entity/Ecurie.php @@ -21,12 +21,12 @@ class Ecurie #[ORM\Column(length: 255)] private ?string $picture = null; - #[ORM\OneToMany(mappedBy: 'ecurie', targetEntity: Pilotes::class, orphanRemoval: true)] - private Collection $pilotes; + #[ORM\OneToMany(mappedBy: 'ecurie', targetEntity: Clothes::class, orphanRemoval: true)] + private Collection $clothes; public function __construct() { - $this->pilotes = new ArrayCollection(); + $this->clothes = new ArrayCollection(); } public function getId(): ?int @@ -59,29 +59,29 @@ class Ecurie } /** - * @return Collection<int, Pilotes> + * @return Collection<int, Clothes> */ - public function getPilotes(): Collection + public function getClothes(): Collection { - return $this->pilotes; + return $this->clothes; } - public function addPilote(Pilotes $pilote): self + public function addClothes(Clothes $clothes): self { - if (!$this->pilotes->contains($pilote)) { - $this->pilotes->add($pilote); - $pilote->setEcurie($this); + if (!$this->clothes->contains($clothes)) { + $this->clothes->add($clothes); + $clothes->setEcurie($this); } return $this; } - public function removePilote(Pilotes $pilote): self + public function removeClothes(Clothes $clothes): self { - if ($this->pilotes->removeElement($pilote)) { + if ($this->clothes->removeElement($clothes)) { // set the owning side to null (unless already changed) - if ($pilote->getEcurie() === $this) { - $pilote->setEcurie(null); + if ($clothes->getEcurie() === $this) { + $clothes->setEcurie(null); } } diff --git a/src/Entity/Pilotes.php b/src/Entity/Pilotes.php deleted file mode 100644 index 56c2c51cd835168fad6a4525f8b87fcc461934dc..0000000000000000000000000000000000000000 --- a/src/Entity/Pilotes.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php - -namespace App\Entity; - -use App\Repository\PilotesRepository; -use Doctrine\ORM\Mapping as ORM; - -#[ORM\Entity(repositoryClass: PilotesRepository::class)] -class Pilotes -{ - #[ORM\Id] - #[ORM\GeneratedValue] - #[ORM\Column] - private ?int $id = null; - - #[ORM\Column(length: 255)] - private ?string $name = null; - - #[ORM\Column(length: 255)] - private ?string $picture = null; - - #[ORM\ManyToOne(inversedBy: 'pilotes')] - #[ORM\JoinColumn(nullable: false)] - private ?Ecurie $ecurie = null; - - public function getId(): ?int - { - return $this->id; - } - - public function getName(): ?string - { - return $this->name; - } - - public function setName(string $name): self - { - $this->name = $name; - - return $this; - } - - public function getPicture(): ?string - { - return $this->picture; - } - - public function setPicture(string $picture): self - { - $this->picture = $picture; - - return $this; - } - - public function getEcurie(): ?Ecurie - { - return $this->ecurie; - } - - public function setEcurie(?Ecurie $ecurie): self - { - $this->ecurie = $ecurie; - - return $this; - } -} diff --git a/src/Repository/PilotesRepository.php b/src/Repository/PilotesRepository.php deleted file mode 100644 index 205012da309d5f1518fe148027e4196a49282276..0000000000000000000000000000000000000000 --- a/src/Repository/PilotesRepository.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php - -namespace App\Repository; - -use App\Entity\Pilotes; -use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; -use Doctrine\Persistence\ManagerRegistry; - -/** - * @extends ServiceEntityRepository<Pilotes> - * - * @method Pilotes|null find($id, $lockMode = null, $lockVersion = null) - * @method Pilotes|null findOneBy(array $criteria, array $orderBy = null) - * @method Pilotes[] findAll() - * @method Pilotes[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) - */ -class PilotesRepository extends ServiceEntityRepository -{ - public function __construct(ManagerRegistry $registry) - { - parent::__construct($registry, Pilotes::class); - } - - public function save(Pilotes $entity, bool $flush = false): void - { - $this->getEntityManager()->persist($entity); - - if ($flush) { - $this->getEntityManager()->flush(); - } - } - - public function remove(Pilotes $entity, bool $flush = false): void - { - $this->getEntityManager()->remove($entity); - - if ($flush) { - $this->getEntityManager()->flush(); - } - } - -// /** -// * @return Pilotes[] Returns an array of Pilotes objects -// */ -// public function findByExampleField($value): array -// { -// return $this->createQueryBuilder('p') -// ->andWhere('p.exampleField = :val') -// ->setParameter('val', $value) -// ->orderBy('p.id', 'ASC') -// ->setMaxResults(10) -// ->getQuery() -// ->getResult() -// ; -// } - -// public function findOneBySomeField($value): ?Pilotes -// { -// return $this->createQueryBuilder('p') -// ->andWhere('p.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } -} diff --git a/templates/home.html.twig b/templates/home.html.twig index 3e7d0184c04b8c4611e6ac0a046f7ec8ff160f95..5a10033595f1946b8c4bae6527ce9ca8edf0669d 100644 --- a/templates/home.html.twig +++ b/templates/home.html.twig @@ -7,56 +7,13 @@ <div class="text-center capitalize font-semibold text-xl">équipes</div> <div> <ul class="flex flex-row justify-center"> - <li> - <a href=""> - <img src="{{ asset('img/logo_equipes/mercedes.svg') }}" class="w-[50px] m-[15px]" alt=""> - </a> - </li> - <li> - <a href=""> - <img src="{{ asset('img/logo_equipes/redbull.svg') }}" class="w-[50px] m-[15px]" alt=""> - </a> - </li> - <li> - <a href=""> - <img src="{{ asset('img/logo_equipes/ferrari.svg') }}" class="w-[50px] m-[15px]" alt=""> - </a> - </li> - <li> - <a href=""> - <img src="{{ asset('img/logo_equipes/mclaren.svg') }}" class="w-[50px] m-[15px]" alt=""> - </a> - </li> - <li> - <a href=""> - <img src="{{ asset('img/logo_equipes/alfa_romeo.svg') }}" class="w-[50px] m-[15px]" alt=""> - </a> - </li> - <li> - <a href=""> - <img src="{{ asset('img/logo_equipes/aston_martin.svg') }}" class="w-[50px] m-[15px]" alt=""> - </a> - </li> - <li> - <a href=""> - <img src="{{ asset('img/logo_equipes/alpine.svg') }}" class="w-[50px] m-[15px]" alt=""> - </a> - </li> - <li> - <a href=""> - <img src="{{ asset('img/logo_equipes/alpha_tauri.svg') }}" class="w-[50px] m-[15px]" alt=""> - </a> - </li> - <li> - <a href=""> - <img src="{{ asset('img/logo_equipes/williams.svg') }}" class="w-[50px] m-[15px]" alt=""> - </a> - </li> - <li class="flex items-center"> - <a href=""> - <img src="{{ asset('img/logo_equipes/fia.svg') }}" class="w-[50px] m-[15px]" alt=""> - </a> - </li> + {% for ecurie in ecuries %} + <li class="flex items-center"> + <a href="{{ path('app_ecurie_show', {'id': ecurie.id}) }}"> + <img src="{{ ecurie.picture }}" class="w-[50px] m-[15px]" alt=""> + </a> + </li> + {% endfor %} </ul> </div> diff --git a/templates/layouts/_header.html.twig b/templates/layouts/_header.html.twig index ab45b56289bfdb0e81c23be0a6cc2b6e6c87deac..09584649fba301dfed9d4381edc391d0358c0429 100644 --- a/templates/layouts/_header.html.twig +++ b/templates/layouts/_header.html.twig @@ -21,13 +21,13 @@ </header> <nav> <ul class="flex flex-row justify-around uppercase"> - <li class="hover:bg-[#EEEEEE] px-[1rem] font-medium"> + <li class="hover:bg-[#EEEEEE] px-[1rem] font-medium w-full text-center"> <a href="" class="leading-[2.1875rem] ">équipes</a> </li> - <li class="hover:bg-[#EEEEEE] px-[1rem] font-medium"> + <li class="hover:bg-[#EEEEEE] px-[1rem] font-medium w-full text-center"> <a href="" class="leading-[2.1875rem] ">pilotes</a> </li> - <li class="hover:bg-[#EEEEEE] px-[1rem] font-medium"> + <li class="hover:bg-[#EEEEEE] px-[1rem] font-medium w-full text-center"> <a href="" class="leading-[2.1875rem] ">casquettes et chapeaux</a> </li> </ul>