refs #423. Create new datatables organizational_unit

pull/7/head
Manuel Aranda Rosales 2024-06-05 15:31:49 +02:00
parent 9aa0514720
commit 30fa682a46
4 changed files with 149 additions and 0 deletions

View File

@ -0,0 +1,32 @@
<?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 Version20240605094344 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('ALTER TABLE organizational_unit ADD type VARCHAR(255) NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE organizational_unit DROP type');
}
}

View File

@ -0,0 +1,33 @@
<?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 Version20240605100013 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('ALTER TABLE organizational_unit ADD network_settings VARCHAR(255) DEFAULT NULL, ADD location VARCHAR(255) DEFAULT NULL, ADD projector TINYINT(1) DEFAULT NULL, ADD board TINYINT(1) DEFAULT NULL, CHANGE network_settings_id capacity INT DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE organizational_unit DROP network_settings, DROP location, DROP projector, DROP board, CHANGE capacity network_settings_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE organizational_unit ADD CONSTRAINT FK_749AEB2D9B9A36D0 FOREIGN KEY (network_settings_id) REFERENCES network_settings (id)');
$this->addSql('CREATE INDEX IDX_749AEB2D9B9A36D0 ON organizational_unit (network_settings_id)');
}
}

View File

@ -45,6 +45,7 @@ class OrganizationalUnit extends AbstractEntity
private Collection $organizationalUnits;
#[ORM\ManyToOne(inversedBy: 'organizationalUnits')]
#[ORM\Column(nullable: true)]
private ?NetworkSettings $networkSettings = null;
/**
@ -59,6 +60,21 @@ class OrganizationalUnit extends AbstractEntity
#[ORM\OneToMany(mappedBy: 'organizationalUnit', targetEntity: Client::class)]
private Collection $clients;
#[ORM\Column(length: 255)]
private ?string $type = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $location = null;
#[ORM\Column(nullable: true)]
private ?bool $projector = null;
#[ORM\Column(nullable: true)]
private ?bool $board = null;
#[ORM\Column(nullable: true)]
private ?int $capacity = null;
public function __construct()
{
parent::__construct();
@ -236,4 +252,64 @@ class OrganizationalUnit extends AbstractEntity
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): static
{
$this->type = $type;
return $this;
}
public function getLocation(): ?string
{
return $this->location;
}
public function setLocation(?string $location): static
{
$this->location = $location;
return $this;
}
public function isProjector(): ?bool
{
return $this->projector;
}
public function setProjector(?bool $projector): static
{
$this->projector = $projector;
return $this;
}
public function isBoard(): ?bool
{
return $this->board;
}
public function setBoard(?bool $board): static
{
$this->board = $board;
return $this;
}
public function getCapacity(): ?int
{
return $this->capacity;
}
public function setCapacity(?int $capacity): static
{
$this->capacity = $capacity;
return $this;
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace App\Model;
class OrganizationalUnitTypes
{
}