Merge branch 'feature/organizational-unit-hierarchy' into feature/views
commit
c9c0fbe863
|
@ -0,0 +1,31 @@
|
||||||
|
<?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 Version20240718064611 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 client ADD position JSON DEFAULT NULL COMMENT \'(DC2Type:json)\'');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE client DROP position');
|
||||||
|
}
|
||||||
|
}
|
|
@ -62,6 +62,7 @@ class MigrateClientsCommand extends Command
|
||||||
$clientEntity->setNetdriver($client['netdriver']);
|
$clientEntity->setNetdriver($client['netdriver']);
|
||||||
$clientEntity->setMac($client['mac']);
|
$clientEntity->setMac($client['mac']);
|
||||||
$clientEntity->setIp($client['ip']);
|
$clientEntity->setIp($client['ip']);
|
||||||
|
$clientEntity->setPosition(['x' => 0, 'y' => 0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$migrationId = $client['ordenadores.grupoid'] === 0 ? $client['ordenadores.idaula'] : $client['ordenadores.grupoid'];
|
$migrationId = $client['ordenadores.grupoid'] === 0 ? $client['ordenadores.idaula'] : $client['ordenadores.grupoid'];
|
||||||
|
|
|
@ -14,7 +14,7 @@ use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
#[AsCommand(name: 'opengnsys:migrate-hardware-profile', description: 'Migrate hardware and hardware profile data')]
|
#[AsCommand(name: 'opengnsys:migration:hardware-profile', description: 'Migrate hardware and hardware profile data')]
|
||||||
class MigrateHardwareAndHardwareProfileCommand extends Command
|
class MigrateHardwareAndHardwareProfileCommand extends Command
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
|
@ -13,7 +13,7 @@ use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
#[AsCommand(name: 'opengnsys:migrate-software-profile', description: 'Migrate software and software profile data')]
|
#[AsCommand(name: 'opengnsys:migration:software-profile', description: 'Migrate software and software profile data')]
|
||||||
class MigrateSoftwareAndSoftwareProfileCommand extends Command
|
class MigrateSoftwareAndSoftwareProfileCommand extends Command
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
|
@ -75,6 +75,12 @@ final class ClientInput
|
||||||
)]
|
)]
|
||||||
public ?HardwareProfileOutput $hardwareProfile = null;
|
public ?HardwareProfileOutput $hardwareProfile = null;
|
||||||
|
|
||||||
|
#[Groups(['client:write'])]
|
||||||
|
#[ApiProperty(
|
||||||
|
description: 'descriptions.client.validation'
|
||||||
|
)]
|
||||||
|
public ?array $position = ['x' => 0, 'y' => 0];
|
||||||
|
|
||||||
public function __construct(?Client $client = null)
|
public function __construct(?Client $client = null)
|
||||||
{
|
{
|
||||||
if (!$client) {
|
if (!$client) {
|
||||||
|
@ -88,6 +94,7 @@ final class ClientInput
|
||||||
$this->netDriver = $client->getNetDriver();
|
$this->netDriver = $client->getNetDriver();
|
||||||
$this->mac = $client->getMac();
|
$this->mac = $client->getMac();
|
||||||
$this->ip = $client->getIp();
|
$this->ip = $client->getIp();
|
||||||
|
$this->position = $client->getPosition();
|
||||||
|
|
||||||
if ($client->getMenu()) {
|
if ($client->getMenu()) {
|
||||||
$this->menu = new MenuOutput($client->getMenu());
|
$this->menu = new MenuOutput($client->getMenu());
|
||||||
|
@ -113,6 +120,7 @@ final class ClientInput
|
||||||
$client->setIp($this->ip);
|
$client->setIp($this->ip);
|
||||||
$client->setMenu($this->menu?->getEntity());
|
$client->setMenu($this->menu?->getEntity());
|
||||||
$client->setHardwareProfile($this->hardwareProfile?->getEntity());
|
$client->setHardwareProfile($this->hardwareProfile?->getEntity());
|
||||||
|
$client->setPosition($this->position);
|
||||||
|
|
||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,9 @@ final class ClientOutput extends AbstractOutput
|
||||||
#[ApiProperty(readableLink: true )]
|
#[ApiProperty(readableLink: true )]
|
||||||
public ?HardwareProfileOutput $hardwareProfile = null;
|
public ?HardwareProfileOutput $hardwareProfile = null;
|
||||||
|
|
||||||
|
#[Groups(['client:read'])]
|
||||||
|
public ?array $position = ['x' => 0, 'y' => 0];
|
||||||
|
|
||||||
#[Groups(['client:read'])]
|
#[Groups(['client:read'])]
|
||||||
public \DateTime $createdAt;
|
public \DateTime $createdAt;
|
||||||
|
|
||||||
|
@ -74,8 +77,8 @@ final class ClientOutput extends AbstractOutput
|
||||||
)->toArray();
|
)->toArray();
|
||||||
|
|
||||||
$this->menu = $client->getMenu() ? new MenuOutput($client->getMenu()) : null;
|
$this->menu = $client->getMenu() ? new MenuOutput($client->getMenu()) : null;
|
||||||
|
$this->position = $client->getPosition();
|
||||||
$this->hardwareProfile = $client->getHardwareProfile() ? new HardwareProfileOutput($client->getHardwareProfile()) : null;
|
$this->hardwareProfile = $client->getHardwareProfile() ? new HardwareProfileOutput($client->getHardwareProfile()) : null;
|
||||||
|
|
||||||
$this->createdAt = $client->getCreatedAt();
|
$this->createdAt = $client->getCreatedAt();
|
||||||
$this->createdBy = $client->getCreatedBy();
|
$this->createdBy = $client->getCreatedBy();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,9 @@ class Client extends AbstractEntity
|
||||||
#[ORM\Column(nullable: true)]
|
#[ORM\Column(nullable: true)]
|
||||||
private ?bool $validation = null;
|
private ?bool $validation = null;
|
||||||
|
|
||||||
|
#[ORM\Column(nullable: true)]
|
||||||
|
private ?array $position = ['x' => 0, 'y' => 0];
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
@ -209,4 +212,16 @@ class Client extends AbstractEntity
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPosition(): ?array
|
||||||
|
{
|
||||||
|
return $this->position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPosition(?array $position): static
|
||||||
|
{
|
||||||
|
$this->position = $position;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue