refs #423. New tables hardware and hardware-profile
parent
dc12acd29e
commit
8060638809
|
@ -1,34 +0,0 @@
|
|||
<?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 Version20240529131520 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 DROP FOREIGN KEY FK_749AEB2D727ACA70');
|
||||
$this->addSql('ALTER TABLE organizational_unit ADD CONSTRAINT FK_749AEB2D727ACA70 FOREIGN KEY (parent_id) REFERENCES organizational_unit (id) ON DELETE SET 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 FOREIGN KEY FK_749AEB2D727ACA70');
|
||||
$this->addSql('ALTER TABLE organizational_unit ADD CONSTRAINT FK_749AEB2D727ACA70 FOREIGN KEY (parent_id) REFERENCES organizational_unit (id)');
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?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)');
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration;
|
|||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20240528093352 extends AbstractMigration
|
||||
final class Version20240606081620 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
|
@ -26,14 +26,14 @@ final class Version20240528093352 extends AbstractMigration
|
|||
$this->addSql('CREATE TABLE gruposordenadores (idgrupo INT AUTO_INCREMENT NOT NULL, nombregrupoordenador VARCHAR(255) NOT NULL, idaula VARCHAR(255) NOT NULL, grupoid VARCHAR(255) NOT NULL, comentarios VARCHAR(255) NOT NULL, PRIMARY KEY(idgrupo)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE network_settings (id INT AUTO_INCREMENT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, proxy VARCHAR(255) DEFAULT NULL, dns VARCHAR(255) DEFAULT NULL, netmask VARCHAR(255) DEFAULT NULL, router VARCHAR(255) DEFAULT NULL, ntp VARCHAR(255) DEFAULT NULL, p2p_time INT DEFAULT NULL, p2p_mode VARCHAR(255) DEFAULT NULL, mcast_ip VARCHAR(255) DEFAULT NULL, mcast_speed INT NOT NULL, mcast_mode VARCHAR(255) DEFAULT NULL, mcast_port INT DEFAULT NULL, UNIQUE INDEX UNIQ_48869B54D17F50A6 (uuid), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE ordenadores (idordenador INT AUTO_INCREMENT NOT NULL, PRIMARY KEY(idordenador)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE organizational_unit (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, network_settings_id INT DEFAULT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, comments VARCHAR(255) DEFAULT NULL, path VARCHAR(255) DEFAULT NULL, level INT DEFAULT NULL, slug VARCHAR(255) DEFAULT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_749AEB2DD17F50A6 (uuid), INDEX IDX_749AEB2D727ACA70 (parent_id), INDEX IDX_749AEB2D9B9A36D0 (network_settings_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE organizational_unit (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, network_settings_id INT DEFAULT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, comments VARCHAR(255) DEFAULT NULL, path VARCHAR(255) DEFAULT NULL, level INT DEFAULT NULL, slug VARCHAR(255) DEFAULT NULL, type VARCHAR(255) NOT NULL, location VARCHAR(255) DEFAULT NULL, projector TINYINT(1) DEFAULT NULL, board TINYINT(1) DEFAULT NULL, capacity INT DEFAULT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_749AEB2DD17F50A6 (uuid), INDEX IDX_749AEB2D727ACA70 (parent_id), INDEX IDX_749AEB2D9B9A36D0 (network_settings_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE refresh_tokens (id INT AUTO_INCREMENT NOT NULL, refresh_token VARCHAR(128) NOT NULL, username VARCHAR(255) NOT NULL, valid DATETIME NOT NULL, UNIQUE INDEX UNIQ_9BACE7E1C74F2195 (refresh_token), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, username VARCHAR(180) NOT NULL, roles JSON NOT NULL COMMENT \'(DC2Type:json)\', password VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_8D93D649D17F50A6 (uuid), UNIQUE INDEX UNIQ_IDENTIFIER_USERNAME (username), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE user_organizational_unit (user_id INT NOT NULL, organizational_unit_id INT NOT NULL, INDEX IDX_5E59845FA76ED395 (user_id), INDEX IDX_5E59845FFB84408A (organizational_unit_id), PRIMARY KEY(user_id, organizational_unit_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE user_group (id INT AUTO_INCREMENT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, permissions JSON NOT NULL COMMENT \'(DC2Type:json)\', name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_8F02BF9DD17F50A6 (uuid), UNIQUE INDEX UNIQ_IDENTIFIER_NAME (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE user_group_user (user_group_id INT NOT NULL, user_id INT NOT NULL, INDEX IDX_3AE4BD51ED93D47 (user_group_id), INDEX IDX_3AE4BD5A76ED395 (user_id), PRIMARY KEY(user_group_id, user_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C7440455FB84408A FOREIGN KEY (organizational_unit_id) REFERENCES organizational_unit (id)');
|
||||
$this->addSql('ALTER TABLE organizational_unit ADD CONSTRAINT FK_749AEB2D727ACA70 FOREIGN KEY (parent_id) REFERENCES organizational_unit (id)');
|
||||
$this->addSql('ALTER TABLE organizational_unit ADD CONSTRAINT FK_749AEB2D727ACA70 FOREIGN KEY (parent_id) REFERENCES organizational_unit (id) ON DELETE SET NULL');
|
||||
$this->addSql('ALTER TABLE organizational_unit ADD CONSTRAINT FK_749AEB2D9B9A36D0 FOREIGN KEY (network_settings_id) REFERENCES network_settings (id)');
|
||||
$this->addSql('ALTER TABLE user_organizational_unit ADD CONSTRAINT FK_5E59845FA76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE user_organizational_unit ADD CONSTRAINT FK_5E59845FFB84408A FOREIGN KEY (organizational_unit_id) REFERENCES organizational_unit (id) ON DELETE CASCADE');
|
|
@ -0,0 +1,47 @@
|
|||
<?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 Version20240606102152 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('CREATE TABLE hardware (id INT AUTO_INCREMENT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_FE99E9E0D17F50A6 (uuid), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE hardware_profile (id INT AUTO_INCREMENT NOT NULL, organizational_unit_id INT DEFAULT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, comments VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_2D9A2460D17F50A6 (uuid), INDEX IDX_2D9A2460FB84408A (organizational_unit_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE hardware_profile_hardware (hardware_profile_id INT NOT NULL, hardware_id INT NOT NULL, INDEX IDX_18C7E12CFA495C1 (hardware_profile_id), INDEX IDX_18C7E12C9CC762B (hardware_id), PRIMARY KEY(hardware_profile_id, hardware_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE hardware_profile ADD CONSTRAINT FK_2D9A2460FB84408A FOREIGN KEY (organizational_unit_id) REFERENCES organizational_unit (id)');
|
||||
$this->addSql('ALTER TABLE hardware_profile_hardware ADD CONSTRAINT FK_18C7E12CFA495C1 FOREIGN KEY (hardware_profile_id) REFERENCES hardware_profile (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE hardware_profile_hardware ADD CONSTRAINT FK_18C7E12C9CC762B FOREIGN KEY (hardware_id) REFERENCES hardware (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE client ADD hardware_profile_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C7440455CFA495C1 FOREIGN KEY (hardware_profile_id) REFERENCES hardware_profile (id)');
|
||||
$this->addSql('CREATE INDEX IDX_C7440455CFA495C1 ON client (hardware_profile_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE client DROP FOREIGN KEY FK_C7440455CFA495C1');
|
||||
$this->addSql('ALTER TABLE hardware_profile DROP FOREIGN KEY FK_2D9A2460FB84408A');
|
||||
$this->addSql('ALTER TABLE hardware_profile_hardware DROP FOREIGN KEY FK_18C7E12CFA495C1');
|
||||
$this->addSql('ALTER TABLE hardware_profile_hardware DROP FOREIGN KEY FK_18C7E12C9CC762B');
|
||||
$this->addSql('DROP TABLE hardware');
|
||||
$this->addSql('DROP TABLE hardware_profile');
|
||||
$this->addSql('DROP TABLE hardware_profile_hardware');
|
||||
$this->addSql('DROP INDEX IDX_C7440455CFA495C1 ON client');
|
||||
$this->addSql('ALTER TABLE client DROP hardware_profile_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
class ClientInput
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
class HardwareInput
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
class ClientOutput
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
class HardwareOutput
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
class NetworkSettingsOutput
|
||||
{
|
||||
|
||||
}
|
|
@ -32,6 +32,9 @@ class Client extends AbstractEntity
|
|||
#[ORM\ManyToOne(inversedBy: 'clients')]
|
||||
private ?OrganizationalUnit $organizationalUnit = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'clients')]
|
||||
private ?HardwareProfile $hardwareProfile = null;
|
||||
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
|
@ -74,7 +77,7 @@ class Client extends AbstractEntity
|
|||
return $this->netDriver;
|
||||
}
|
||||
|
||||
public function setNetDriver(string $netDriver): static
|
||||
public function setNetDriver(?string $netDriver): static
|
||||
{
|
||||
$this->netDriver = $netDriver;
|
||||
|
||||
|
@ -128,4 +131,16 @@ class Client extends AbstractEntity
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getHardwareProfile(): ?HardwareProfile
|
||||
{
|
||||
return $this->hardwareProfile;
|
||||
}
|
||||
|
||||
public function setHardwareProfile(?HardwareProfile $hardwareProfile): static
|
||||
{
|
||||
$this->hardwareProfile = $hardwareProfile;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\HardwareRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: HardwareRepository::class)]
|
||||
class Hardware extends AbstractEntity
|
||||
{
|
||||
use NameableTrait;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $type = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, HardwareProfile>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: HardwareProfile::class, mappedBy: 'hardwareCollection')]
|
||||
private Collection $hardwareProfiles;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__Construct();
|
||||
|
||||
$this->hardwareProfiles = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): static
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getType(): ?string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function setType(?string $type): static
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, HardwareProfile>
|
||||
*/
|
||||
public function getHardwareProfiles(): Collection
|
||||
{
|
||||
return $this->hardwareProfiles;
|
||||
}
|
||||
|
||||
public function addHardwareProfile(HardwareProfile $hardwareProfile): static
|
||||
{
|
||||
if (!$this->hardwareProfiles->contains($hardwareProfile)) {
|
||||
$this->hardwareProfiles->add($hardwareProfile);
|
||||
$hardwareProfile->addHardwareCollection($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeHardwareProfile(HardwareProfile $hardwareProfile): static
|
||||
{
|
||||
if ($this->hardwareProfiles->removeElement($hardwareProfile)) {
|
||||
$hardwareProfile->removeHardwareCollection($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\HardwareProfileRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: HardwareProfileRepository::class)]
|
||||
class HardwareProfile extends AbstractEntity
|
||||
{
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $comments = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'hardwareProfiles')]
|
||||
private ?OrganizationalUnit $organizationalUnit = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Hardware>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: Hardware::class, inversedBy: 'hardwareProfiles')]
|
||||
private Collection $hardwareCollection;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Client>
|
||||
*/
|
||||
#[ORM\OneToMany(mappedBy: 'hardwareProfile', targetEntity: Client::class)]
|
||||
private Collection $clients;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->hardwareCollection = new ArrayCollection();
|
||||
$this->clients = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): static
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getComments(): ?string
|
||||
{
|
||||
return $this->comments;
|
||||
}
|
||||
|
||||
public function setComments(?string $comments): static
|
||||
{
|
||||
$this->comments = $comments;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOrganizationalUnit(): ?OrganizationalUnit
|
||||
{
|
||||
return $this->organizationalUnit;
|
||||
}
|
||||
|
||||
public function setOrganizationalUnit(?OrganizationalUnit $organizationalUnit): static
|
||||
{
|
||||
$this->organizationalUnit = $organizationalUnit;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Hardware>
|
||||
*/
|
||||
public function getHardwareCollection(): Collection
|
||||
{
|
||||
return $this->hardwareCollection;
|
||||
}
|
||||
|
||||
public function addHardwareCollection(Hardware $hardwareCollection): static
|
||||
{
|
||||
if (!$this->hardwareCollection->contains($hardwareCollection)) {
|
||||
$this->hardwareCollection->add($hardwareCollection);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeHardwareCollection(Hardware $hardwareCollection): static
|
||||
{
|
||||
$this->hardwareCollection->removeElement($hardwareCollection);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Client>
|
||||
*/
|
||||
public function getClients(): Collection
|
||||
{
|
||||
return $this->clients;
|
||||
}
|
||||
|
||||
public function addClient(Client $client): static
|
||||
{
|
||||
if (!$this->clients->contains($client)) {
|
||||
$this->clients->add($client);
|
||||
$client->setHardwareProfile($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeClient(Client $client): static
|
||||
{
|
||||
if ($this->clients->removeElement($client)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($client->getHardwareProfile() === $this) {
|
||||
$client->setHardwareProfile(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -46,7 +46,7 @@ class NetworkSettings extends AbstractEntity
|
|||
/**
|
||||
* @var Collection<int, OrganizationalUnit>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: OrganizationalUnit::class, mappedBy: 'networkSettings')]
|
||||
#[ORM\OneToMany(mappedBy: 'networkSettings', targetEntity: OrganizationalUnit::class)]
|
||||
private Collection $organizationalUnits;
|
||||
|
||||
public function __construct()
|
||||
|
@ -221,4 +221,9 @@ class NetworkSettings extends AbstractEntity
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->getId() ? (string) $this->getId() : '';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,8 +44,8 @@ class OrganizationalUnit extends AbstractEntity
|
|||
#[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class)]
|
||||
private Collection $organizationalUnits;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'organizationalUnits')]
|
||||
#[ORM\Column(nullable: true)]
|
||||
#[ORM\ManyToOne(targetEntity: NetworkSettings::class, inversedBy: 'organizationalUnits')]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
private ?NetworkSettings $networkSettings = null;
|
||||
|
||||
/**
|
||||
|
@ -75,12 +75,19 @@ class OrganizationalUnit extends AbstractEntity
|
|||
#[ORM\Column(nullable: true)]
|
||||
private ?int $capacity = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, HardwareProfile>
|
||||
*/
|
||||
#[ORM\OneToMany(mappedBy: 'organizationalUnit', targetEntity: HardwareProfile::class)]
|
||||
private Collection $hardwareProfiles;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->organizationalUnits = new ArrayCollection();
|
||||
$this->users = new ArrayCollection();
|
||||
$this->clients = new ArrayCollection();
|
||||
$this->hardwareProfiles = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
|
@ -312,4 +319,34 @@ class OrganizationalUnit extends AbstractEntity
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, HardwareProfile>
|
||||
*/
|
||||
public function getHardwareProfiles(): Collection
|
||||
{
|
||||
return $this->hardwareProfiles;
|
||||
}
|
||||
|
||||
public function addHardwareProfile(HardwareProfile $hardwareProfile): static
|
||||
{
|
||||
if (!$this->hardwareProfiles->contains($hardwareProfile)) {
|
||||
$this->hardwareProfiles->add($hardwareProfile);
|
||||
$hardwareProfile->setOrganizationalUnit($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeHardwareProfile(HardwareProfile $hardwareProfile): static
|
||||
{
|
||||
if ($this->hardwareProfiles->removeElement($hardwareProfile)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($hardwareProfile->getOrganizationalUnit() === $this) {
|
||||
$hardwareProfile->setOrganizationalUnit(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,35 +9,10 @@ use Doctrine\Persistence\ManagerRegistry;
|
|||
/**
|
||||
* @extends ServiceEntityRepository<Client>
|
||||
*/
|
||||
class ClientRepository extends ServiceEntityRepository
|
||||
class ClientRepository extends AbstractRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Client::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Client[] Returns an array of Client objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('c')
|
||||
// ->andWhere('c.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('c.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Client
|
||||
// {
|
||||
// return $this->createQueryBuilder('c')
|
||||
// ->andWhere('c.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\HardwareProfile;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<HardwareProfile>
|
||||
*/
|
||||
class HardwareProfileRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, HardwareProfile::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return HardwareProfile[] Returns an array of HardwareProfile objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('h')
|
||||
// ->andWhere('h.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('h.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?HardwareProfile
|
||||
// {
|
||||
// return $this->createQueryBuilder('h')
|
||||
// ->andWhere('h.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Hardware;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Hardware>
|
||||
*/
|
||||
class HardwareRepository extends AbstractRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Hardware::class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace App\State\Processor;
|
||||
|
||||
class ClientProcessor
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace App\State\Processor;
|
||||
|
||||
class HardwareProcessor
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace App\State\Provider;
|
||||
|
||||
class ClientProvider
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace App\State\Provider;
|
||||
|
||||
class HardwareProvider
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue