From 53cbd4bde864bbac2fbe3d81dccf38d97ff44bfc Mon Sep 17 00:00:00 2001 From: Corentin R Date: Wed, 12 Jun 2024 20:11:54 +0200 Subject: [PATCH] Merge et adding style --- assets/styles/app.css | 11 ++++++ migrations/Version20240612112105.php | 35 ------------------ migrations/Version20240612121601.php | 35 ------------------ ...11201839.php => Version20240612171415.php} | 5 ++- src/Controller/ProfilController.php | 9 ++++- src/Entity/Profil.php | 5 --- templates/profil/edit.html.twig | 2 +- var/data.db | Bin 98304 -> 102400 bytes 8 files changed, 22 insertions(+), 80 deletions(-) delete mode 100644 migrations/Version20240612112105.php delete mode 100644 migrations/Version20240612121601.php rename migrations/{Version20240611201839.php => Version20240612171415.php} (94%) diff --git a/assets/styles/app.css b/assets/styles/app.css index ebdb11d..08bac17 100644 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -63,6 +63,17 @@ body { margin: 4px; } +.delete-button { + background-color: #970c2a; + color: #fff; + padding: 10px 20px; + border: none; + border-radius: 4px; + cursor: pointer; + text-align: center; + text-decoration: none; + margin: 4px; +} .count-container { display: flex; margin-left: auto; /* Pushes the container to the right */ diff --git a/migrations/Version20240612112105.php b/migrations/Version20240612112105.php deleted file mode 100644 index 451d975..0000000 --- a/migrations/Version20240612112105.php +++ /dev/null @@ -1,35 +0,0 @@ -addSql('ALTER TABLE profil ADD COLUMN roles CLOB DEFAULT NULL'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('CREATE TEMPORARY TABLE __temp__profil AS SELECT id, name, description, password FROM profil'); - $this->addSql('DROP TABLE profil'); - $this->addSql('CREATE TABLE profil (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, password VARCHAR(255) DEFAULT NULL)'); - $this->addSql('INSERT INTO profil (id, name, description, password) SELECT id, name, description, password FROM __temp__profil'); - $this->addSql('DROP TABLE __temp__profil'); - } -} diff --git a/migrations/Version20240612121601.php b/migrations/Version20240612121601.php deleted file mode 100644 index f40fbff..0000000 --- a/migrations/Version20240612121601.php +++ /dev/null @@ -1,35 +0,0 @@ -addSql('ALTER TABLE profil ADD COLUMN roles CLOB DEFAULT NULL'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('CREATE TEMPORARY TABLE __temp__profil AS SELECT id, name, description, password FROM profil'); - $this->addSql('DROP TABLE profil'); - $this->addSql('CREATE TABLE profil (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, password VARCHAR(255) DEFAULT NULL)'); - $this->addSql('INSERT INTO profil (id, name, description, password) SELECT id, name, description, password FROM __temp__profil'); - $this->addSql('DROP TABLE __temp__profil'); - } -} diff --git a/migrations/Version20240611201839.php b/migrations/Version20240612171415.php similarity index 94% rename from migrations/Version20240611201839.php rename to migrations/Version20240612171415.php index 8d30603..0fd4508 100644 --- a/migrations/Version20240611201839.php +++ b/migrations/Version20240612171415.php @@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration; /** * Auto-generated Migration: Please modify to your needs! */ -final class Version20240611201839 extends AbstractMigration +final class Version20240612171415 extends AbstractMigration { public function getDescription(): string { @@ -28,7 +28,8 @@ final class Version20240611201839 extends AbstractMigration $this->addSql('CREATE TABLE post_tags (post_id INTEGER NOT NULL, tags_id INTEGER NOT NULL, PRIMARY KEY(post_id, tags_id), CONSTRAINT FK_A6E9F32D4B89032C FOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_A6E9F32D8D7B4FB4 FOREIGN KEY (tags_id) REFERENCES tags (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); $this->addSql('CREATE INDEX IDX_A6E9F32D4B89032C ON post_tags (post_id)'); $this->addSql('CREATE INDEX IDX_A6E9F32D8D7B4FB4 ON post_tags (tags_id)'); - $this->addSql('CREATE TABLE profil (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, password VARCHAR(255) DEFAULT NULL)'); + $this->addSql('CREATE TABLE profil (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, roles CLOB DEFAULT NULL --(DC2Type:json) + , name VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, password VARCHAR(255) DEFAULT NULL)'); $this->addSql('CREATE TABLE profil_profil (profil_source INTEGER NOT NULL, profil_target INTEGER NOT NULL, PRIMARY KEY(profil_source, profil_target), CONSTRAINT FK_97293BC52E75F621 FOREIGN KEY (profil_source) REFERENCES profil (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_97293BC53790A6AE FOREIGN KEY (profil_target) REFERENCES profil (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); $this->addSql('CREATE INDEX IDX_97293BC52E75F621 ON profil_profil (profil_source)'); $this->addSql('CREATE INDEX IDX_97293BC53790A6AE ON profil_profil (profil_target)'); diff --git a/src/Controller/ProfilController.php b/src/Controller/ProfilController.php index f2d69c7..0540944 100644 --- a/src/Controller/ProfilController.php +++ b/src/Controller/ProfilController.php @@ -13,12 +13,17 @@ use Symfony\Component\HttpFoundation\Request; class ProfilController extends AbstractController { - private Profil $currentProfil; + public function __construct(private EntityManager $mgr) { } - + #[Route(path:"/profil", name:"profil_perso", methods: ["GET"])] + public function baseProfil(): Response + { + $this->denyAccessUnlessGranted('IS_AUTHENTICATED'); + return $this->redirectToRoute('profil_show', ['id' => $this->getUser()->getId()]); + } #[Route('/profil/{id}',name:'profil_show', requirements: ['page' => '\d+'])] public function profil(int $id): Response { diff --git a/src/Entity/Profil.php b/src/Entity/Profil.php index ca45e7d..0909a5c 100644 --- a/src/Entity/Profil.php +++ b/src/Entity/Profil.php @@ -188,11 +188,6 @@ class Profil implements UserInterface, PasswordAuthenticatedUserInterface return $this; } - public function getUserIdentifier(): string - { - return $this->name; - } - public function eraseCredentials(): void { // TODO: Implement eraseCredentials() method. diff --git a/templates/profil/edit.html.twig b/templates/profil/edit.html.twig index 997fd08..6806fec 100644 --- a/templates/profil/edit.html.twig +++ b/templates/profil/edit.html.twig @@ -20,7 +20,7 @@
- +
{% endblock %} diff --git a/var/data.db b/var/data.db index ac0e2523d0c553dfa6e69bf3b528000c409fdcc3..3346c7056132b9f0ce3ad102330854b453996a4d 100644 GIT binary patch delta 637 zcmY+B%TE(g6vpqR(|PoDix%skksCsSCe|?1D$0gPA2CweiWF)LLWOGvES*P(z7iF5 zBasEJW}^{JB-H4lG^TOkLi-Qs))gC9kYHj+j5NW)u;DDu$#>3|oZrb=SfCeH>6KGf z3IM=A$Nk4CaG|VNO$E`OnE{XXs_HUo@!B`sKT*3V^a=stqSzw_d_9+Zf{2AHeL|p5 zxLn)s_>0)Xxw8f*DK~?*0op~|wbq_Z)q)YoSu@1-l$-b#o8T`CwT6t@t{R? zJWFuqz^*kaSvlXR*#6(t1gL4^>>$>Z77NFjq>25GHzWQHXUyre)|`DH}`;}*d^9gRev!pr4vR~fhUca z0^7|pp+dg?Sb<@hD?1r4&%-Bi<69n%_G)s5#SZoSZ#p!-sJmXVY`UxKV(ojYt80_y@3ixAFi0 delta 1050 zcmYLIO>7%Q6rR~#Z@fDrZaTN0BCT_$bV`m(%yWZXG zU*cR6!zD-+P0PVY3S62VK&^$$1um9Q)v7m6T-r;ifFgv_AE|)KtZfNt^;Y}d`@Zk( z_hxo)io3hw{t3@X0Kl>9_}#&iAiS-6*cS-80UT=%2KUhoU2KZMN9cGo7KtX~=VOsr z;%wyH*=Q8UV&l=|cw)5q=G1HC?bZD)I0s?S_Y838F+h*e%jRI@Cxm^F4?*3~O0wc= z_&O56%kf8`u9+5hcTT`wF3<)j5NO}2w*t8-&I{nwyyW$A+0#VEB_dncRJ=3WiqKpai7&$MMg;-Z{E+(Kd)`;i{%$qkY?q-xb-8`3NX=Cj&B{Hj+n^J}{h4B!n5JxoajG}mfkR~lS6Ic+YOXrd(%4`d zHcOp$M`4yY29d+ApB#D#&_5l+e?$Eq9zu@ec}em&;oO^3U#cyfBf`;|ntzBiWd#=2lYWHKTGRoZ-4u3$)6f z9#wpKIii$G`p9M}Z)=fBCz;O4v#EI{Cz}!5w$s{du98~5xK7Oc*w!UubMlfxnOT|c z0qn%CwiX)^cp=!f3O4l3py@vyaagxvdDGaJ#_1b=yz6sf=-Bn1R>9P*h}g) zymIY-h5ljf{~*j0nl54 z@BMEN+#jI*|N3;_5$`A7rM|~JttFYy-z*|D&3k@ze JzE$C~{{WFhGw}cb