Skip to content

Commit

Permalink
183: add description and location to activitites
Browse files Browse the repository at this point in the history
- add it to events as well
- rememberMe in index.php
  • Loading branch information
Atmos4 committed Mar 26, 2024
1 parent 08ba3a4 commit b4372fe
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 9 deletions.
8 changes: 3 additions & 5 deletions app/pages/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php
if (empty ($_SESSION['user_id'])) {
redirect("login");
} else {
//redirect("accueil");
if (AuthService::create()->isUserLoggedIn()) {
redirect("evenements");
}
}
redirect("login");
2 changes: 1 addition & 1 deletion database/migrations/Version20240324072035.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class Version20240324072035 extends AbstractMigration
{
public function getDescription(): string
{
return '';
return 'activities';
}

public function up(Schema $schema): void
Expand Down
33 changes: 33 additions & 0 deletions database/migrations/Version20240325220331.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace intranose\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240325220331 extends AbstractMigration
{
public function getDescription(): string
{
return 'description and location to events and activities';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE orm_activities ADD location_url VARCHAR(255) NOT NULL, ADD description VARCHAR(255) NOT NULL, CHANGE place location_label VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE orm_events ADD description VARCHAR(255) NOT NULL');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE orm_activities ADD place VARCHAR(255) NOT NULL, DROP location_label, DROP location_url, DROP description');
$this->addSql('ALTER TABLE orm_events DROP description');
}
}
14 changes: 11 additions & 3 deletions database/models/activities.db.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ class Activity
public string $name;

#[Column]
public string $place;
public string $location_label;

#[Column]
public string $location_url;

#[Column]
public string $description;

#[ManyToOne]
public Event|null $event = null;
Expand All @@ -77,11 +83,13 @@ function __construct()
$this->categories = new ArrayCollection();
}

function set(string $name, DateTime $date, string $place, Event $event)
function set(string $name, DateTime $date, Event $event, string $location_label = "", string $location_url = "", string $description = "")
{
$this->name = $name;
$this->place = $place;
$this->date = $date;
$this->event = $event;
$this->location_label = $location_label;
$this->location_url = $location_url;
$this->description = $description;
}
}
3 changes: 3 additions & 0 deletions database/models/events.db.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ class Event
#[Column]
public DateTime $deadline;

#[Column]
public string $description;

#[Column]
public bool $open = false;

Expand Down

0 comments on commit b4372fe

Please sign in to comment.