Move machine's extra information from Task to Recipe

master
Julien Rosset 2 months ago
parent e0b171a200
commit b890b8300f

@ -0,0 +1,41 @@
<?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 Version20250526170059 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
$this->addSql(<<<'SQL'
ALTER TABLE recipe ADD machine_extra_info1 VARCHAR(255) DEFAULT NULL, ADD machine_extra_info2 VARCHAR(255) DEFAULT NULL
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE task DROP machine_extra_info1, DROP machine_extra_info2
SQL);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
ALTER TABLE recipe DROP machine_extra_info1, DROP machine_extra_info2
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE task ADD machine_extra_info1 VARCHAR(255) DEFAULT NULL, ADD machine_extra_info2 VARCHAR(255) DEFAULT NULL
SQL);
}
}

@ -24,6 +24,18 @@ class Recipe {
#[Assert\NotNull(message: 'Veuillez sélectionner une machine de fabrication')]
#[Assert\Valid]
private ?Machine $machine = null;
/**
* @var string|null The machine's first extra information
*/
#[ORM\Column(length: 255, nullable: true)]
#[Assert\NotBlank(message: 'Veuillez saisir l\'information complémentaire n° 1', allowNull: true)]
private ?string $machineExtraInfo1 = null;
/**
* @var string|null The machine's second extra information
*/
#[ORM\Column(length: 255, nullable: true)]
#[Assert\NotBlank(message: 'Veuillez saisir l\'information complémentaire n° 2', allowNull: true)]
private ?string $machineExtraInfo2 = null;
/**
* @var float|null The crafting time, in seconds
*/
@ -77,6 +89,45 @@ class Recipe {
return $this;
}
/**
* The machine's first extra information
*
* @return string|null The machine's first extra information
*/
public function getMachineExtraInfo1 (): ?string {
return $this->machineExtraInfo1;
}
/**
* Set the machine's first extra information
*
* @param string|null $machineExtraInfo1 The machine's first extra information
*
* @return $this
*/
public function setMachineExtraInfo1 (?string $machineExtraInfo1): self {
$this->machineExtraInfo1 = $machineExtraInfo1;
return $this;
}
/**
* The machine's second extra information
*
* @return string|null The machine's second extra information
*/
public function getMachineExtraInfo2 (): ?string {
return $this->machineExtraInfo2;
}
/**
* Set the machine's second extra information
*
* @param string|null $machineExtraInfo2 The machine's second extra information
*
* @return $this
*/
public function setMachineExtraInfo2 (?string $machineExtraInfo2): self {
$this->machineExtraInfo2 = $machineExtraInfo2;
return $this;
}
/**
* The crafting time, in seconds
*

@ -39,19 +39,6 @@ class Task {
#[Assert\Valid]
private ?Recipe $recipe = null;
/**
* @var string|null The label for the first extra information
*/
#[ORM\Column(length: 255, nullable: true)]
#[Assert\NotBlank(message: 'Veuillez saisir l\'information complémentaire n° 1', allowNull: true)]
private ?string $machineExtraInfo1 = null;
/**
* @var string|null The label for the second extra information
*/
#[ORM\Column(length: 255, nullable: true)]
#[Assert\NotBlank(message: 'Veuillez saisir l\'information complémentaire n° 2', allowNull: true)]
private ?string $machineExtraInfo2 = null;
/**
* @var int|null The quantity asked / to produce
*/

Loading…
Cancel
Save