Browse Source

update model with old fields from v1 of framadate

master
Tykayn 1 year ago committed by tykayn
parent
commit
32d966eac3
  1. 10
      doc/evolutions.md
  2. 31
      migrations/Version20210419202522.php
  3. 82
      src/Entity/Comment.php
  4. 1232
      src/Entity/Poll.php

10
doc/evolutions.md

@ -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
```

31
migrations/Version20210419202522.php

@ -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
}
}

82
src/Entity/Comment.php

@ -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;
return $this;
}
$this->owner = $owner;
return $this;
}
public function getText(): ?string {
return $this->text;
}
return $this->text;
}
public function setText( string $text ): self {
$this->text = $text;
return $this;
}
$this->text = $text;
return $this;
}
public function getCreatedAt(): ?DateTimeInterface {
return $this->createdAt;
}
return $this->createdAt;
}
public function setCreatedAt( DateTimeInterface $createdAt ): self {
$this->createdAt = $createdAt;
return $this;
}
$this->createdAt = $createdAt;
return $this;
}
public function getPoll(): ?Poll {
return $this->poll;
}
return $this->poll;
}
public function setPoll( ?Poll $poll ): self {
$this->poll = $poll;
return $this;
}
$this->poll = $poll;
return $this;
}
public function getPseudo(): ?string
{
return $this->pseudo;
}
public function setPseudo(string $pseudo): self
{
$this->pseudo = $pseudo;
return $this;
}
}

1232
src/Entity/Poll.php

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save