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 ac0e252..3346c70 100644 Binary files a/var/data.db and b/var/data.db differ