Material type: add unit

master
Julien Rosset 2 months ago
parent c5730cc3bd
commit 21c7a0c317

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

@ -17,6 +17,13 @@ class MaterialType implements Stringable {
use TBaseEntity; use TBaseEntity;
use TNamedEntity; use TNamedEntity;
/**
* @var string|null The unit
*/
#[ORM\Column(length: 5, nullable: true)]
#[Assert\NotBlank(message: 'Veuillez saisir une unité', allowNull: true)]
private ?string $unit = null;
/** /**
* @var string|null The “stack” name * @var string|null The “stack” name
*/ */
@ -32,6 +39,26 @@ class MaterialType implements Stringable {
#[Assert\Positive(message: 'La taille de pile doit être strictement positive')] #[Assert\Positive(message: 'La taille de pile doit être strictement positive')]
private ?int $stackSize = null; private ?int $stackSize = null;
/**
* The unit
*
* @return string|null The unit
*/
public function getUnit (): ?string {
return $this->unit;
}
/**
* Set the unit
*
* @param string|null $unit The unit
*
* @return $this
*/
public function setUnit (?string $unit): self {
$this->unit = $unit;
return $this;
}
/** /**
* The “stack” name * The “stack” name
* *

Loading…
Cancel
Save