update model with old fields from v1 of framadate

This commit is contained in:
Tykayn 2021-04-19 22:26:49 +02:00 committed by tykayn
parent 750692b030
commit 32d966eac3
4 changed files with 727 additions and 626 deletions

10
doc/evolutions.md Executable file
View File

@ -0,0 +1,10 @@
# Évolutions
Après avoir modifié le modèle de données dans les Entity, lancez la commande pour mettre à jour les getter et setters
```bash
php bin/console make:entity --regenerate
```
et pour mettre à jour le schéma en base de données
```bash
php bin/console doctrine:schema:update --force
```

View File

@ -0,0 +1,31 @@
<?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 Version20210419202522 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
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
}
}

View File

@ -52,59 +52,71 @@ class Comment {
private $poll;
function display() {
return [
'id' => $this->getId(),
'text' => $this->getText(),
'pseudo' => $this->getOwner()->getPseudo(),
'date' => $this->getCreatedAt(),
];
}
return [
'id' => $this->getId(),
'text' => $this->getText(),
'pseudo' => $this->getOwner()->getPseudo(),
'date' => $this->getCreatedAt(),
];
}
function __construct() {
$this->setCreatedAt( new \DateTime() );
}
$this->setCreatedAt( new \DateTime() );
}
public function getId(): ?int {
return $this->id;
}
return $this->id;
}
public function getOwner(): ?Owner {
return $this->owner;
}
return $this->owner;
}
public function setOwner( ?Owner $owner ): self {
$this->owner = $owner;
$this->owner = $owner;
return $this;
}
return $this;
}
public function getText(): ?string {
return $this->text;
}
return $this->text;
}
public function setText( string $text ): self {
$this->text = $text;
$this->text = $text;
return $this;
}
return $this;
}
public function getCreatedAt(): ?DateTimeInterface {
return $this->createdAt;
}
return $this->createdAt;
}
public function setCreatedAt( DateTimeInterface $createdAt ): self {
$this->createdAt = $createdAt;
$this->createdAt = $createdAt;
return $this;
}
return $this;
}
public function getPoll(): ?Poll {
return $this->poll;
}
return $this->poll;
}
public function setPoll( ?Poll $poll ): self {
$this->poll = $poll;
$this->poll = $poll;
return $this;
}
return $this;
}
public function getPseudo(): ?string
{
return $this->pseudo;
}
public function setPseudo(string $pseudo): self
{
$this->pseudo = $pseudo;
return $this;
}
}

File diff suppressed because it is too large Load Diff