diff --git a/app/migrations/Version20210220173846.php b/app/migrations/Version20210220173846.php new file mode 100644 index 0000000..ebb8f82 --- /dev/null +++ b/app/migrations/Version20210220173846.php @@ -0,0 +1,32 @@ +addSql('ALTER TABLE beer ADD description TEXT DEFAULT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SCHEMA public'); + $this->addSql('ALTER TABLE beer DROP description'); + } +} diff --git a/app/src/Entity/Beer.php b/app/src/Entity/Beer.php index 2515ee1..2a7cf72 100644 --- a/app/src/Entity/Beer.php +++ b/app/src/Entity/Beer.php @@ -26,33 +26,73 @@ class Beer * @ORM\Column(type="float", nullable=true) */ private $alcool; - + + /** + * @ORM\Column(type="text", length=2048, nullable=true) + */ + private $description; + + /** + * @return int|null + */ public function getId(): ?int { return $this->id; } - + + /** + * @return null|string + */ public function getName(): ?string { return $this->name; } - + + /** + * @param string $name + * @return Beer + */ public function setName(string $name): self { $this->name = $name; return $this; } - + + /** + * @return float|null + */ public function getAlcool(): ?float { return $this->alcool; } - + + /** + * @param float|null $alcool + * @return Beer + */ public function setAlcool(?float $alcool): self { $this->alcool = $alcool; return $this; } + + /** + * @return mixed + */ + public function getDescription(): ?string + { + return $this->description; + } + + /** + * @param mixed $description + * @return Beer + */ + public function setDescription(?string $description): self + { + $this->description = $description; + return $this; + } } diff --git a/app/src/Form/BeerType.php b/app/src/Form/BeerType.php index 447dbe2..6554e69 100644 --- a/app/src/Form/BeerType.php +++ b/app/src/Form/BeerType.php @@ -3,6 +3,7 @@ namespace App\Form; use App\Entity\Beer; +use FOS\CKEditorBundle\Form\Type\CKEditorType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\PercentType; use Symfony\Component\Form\Extension\Core\Type\TextType; @@ -19,6 +20,7 @@ class BeerType extends AbstractType 'scale' => 1, 'type' => 'fractional', ]) + ->add('description') ; } diff --git a/app/templates/beer/show.html.twig b/app/templates/beer/show.html.twig index fd315fd..b622b58 100644 --- a/app/templates/beer/show.html.twig +++ b/app/templates/beer/show.html.twig @@ -21,6 +21,10 @@