refs #378. Funcionality link organizationalUnit to user. Create organizationalUnit API and migration
parent
7fdda457ee
commit
67db747d4c
|
@ -55,11 +55,13 @@ Para poder actualizar la base de datos:
|
|||
Para inicializar la base de datos:
|
||||
|
||||
```sh
|
||||
docker exec ogcore-php php bin/consoledoctrine:migrations:migrate --no-interaction
|
||||
docker exec ogcore-php php bin/console doctrine:migrations:migrate --no-interaction
|
||||
```
|
||||
|
||||
```sh
|
||||
docker exec ogcore-php php bin/console doctrine:fixtures:load --no-interaction
|
||||
docker exec ogcore-php php bin/console app:load-default-user-groups
|
||||
|
||||
```
|
||||
|
||||
## Test
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
resources:
|
||||
App\Entity\OrganizationalUnit:
|
||||
processor: App\State\Processor\OrganizationalUnitProcessor
|
||||
input: App\Dto\Input\OrganizationalUnitInput
|
||||
output: App\Dto\Output\OrganizationalUnitOutput
|
||||
normalization_context:
|
||||
groups: ['default', 'organizational-unit:read']
|
||||
denormalization_context:
|
||||
groups: ['organizational-unit:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\OrganizationalUnitProvider
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\OrganizationalUnitProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\OrganizationalUnitProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\OrganizationalUnitProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
properties:
|
||||
App\Entity\OrganizationalUnit:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -1,8 +1,8 @@
|
|||
resources:
|
||||
App\Entity\User:
|
||||
processor: App\State\Processor\UserProcessor
|
||||
input: App\Dto\Input\UserInput
|
||||
output: App\Dto\Output\UserOutput
|
||||
processor: App\State\Processor\UserProcessor
|
||||
normalization_context:
|
||||
groups: ['default', 'user:read']
|
||||
denormalization_context:
|
||||
|
|
|
@ -17,7 +17,7 @@ api_platform:
|
|||
standard_put: true
|
||||
rfc_7807_compliant_errors: true
|
||||
event_listeners_backward_compatibility_layer: false
|
||||
keep_legacy_inflector: false
|
||||
keep_legacy_inflector: true
|
||||
docs_formats:
|
||||
jsonld: ['application/ld+json']
|
||||
jsonopenapi: ['application/vnd.openapi+json']
|
||||
|
|
|
@ -3,4 +3,6 @@ stof_doctrine_extensions:
|
|||
orm:
|
||||
default:
|
||||
timestampable: true
|
||||
blameable: true
|
||||
blameable: true
|
||||
tree: true
|
||||
sluggable: true
|
|
@ -35,3 +35,7 @@ services:
|
|||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\OrganizationalUnitProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
|
@ -1,31 +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 Version20240517085550 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 user (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(180) NOT NULL, roles JSON NOT NULL COMMENT \'(DC2Type:json)\', password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_IDENTIFIER_USERNAME (username), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP TABLE user');
|
||||
}
|
||||
}
|
|
@ -1,31 +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 Version20240517101651 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 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');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP TABLE refresh_tokens');
|
||||
}
|
||||
}
|
|
@ -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 Version20240523091838 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 user ADD uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', ADD migration_id VARCHAR(255) DEFAULT NULL');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D649D17F50A6 ON user (uuid)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP INDEX UNIQ_8D93D649D17F50A6 ON user');
|
||||
$this->addSql('ALTER TABLE user DROP uuid, DROP migration_id');
|
||||
}
|
||||
}
|
|
@ -1,31 +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 Version20240523093000 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 user ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE user DROP created_at, DROP updated_at');
|
||||
}
|
||||
}
|
|
@ -1,31 +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 Version20240523093036 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 user ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL, ADD created_by VARCHAR(255) DEFAULT NULL, ADD updated_by VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE user DROP created_at, DROP updated_at, DROP created_by, DROP updated_by');
|
||||
}
|
||||
}
|
|
@ -1,37 +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 Version20240523094836 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 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, name VARCHAR(255) NOT NULL, roles JSON NOT NULL COMMENT \'(DC2Type:json)\', UNIQUE INDEX UNIQ_8F02BF9DD17F50A6 (uuid), 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 user_group_user ADD CONSTRAINT FK_3AE4BD51ED93D47 FOREIGN KEY (user_group_id) REFERENCES user_group (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE user_group_user ADD CONSTRAINT FK_3AE4BD5A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE user_group_user DROP FOREIGN KEY FK_3AE4BD51ED93D47');
|
||||
$this->addSql('ALTER TABLE user_group_user DROP FOREIGN KEY FK_3AE4BD5A76ED395');
|
||||
$this->addSql('DROP TABLE user_group');
|
||||
$this->addSql('DROP TABLE user_group_user');
|
||||
}
|
||||
}
|
|
@ -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 Version20240524063952 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 organizational_unit (id INT AUTO_INCREMENT NOT NULL, parent_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_749AEB2DD17F50A6 (uuid), INDEX IDX_749AEB2D727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE organizational_unit ADD CONSTRAINT FK_749AEB2D727ACA70 FOREIGN KEY (parent_id) REFERENCES organizational_unit (id)');
|
||||
}
|
||||
|
||||
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('DROP TABLE organizational_unit');
|
||||
}
|
||||
}
|
|
@ -1,38 +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 Version20240524065625 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 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('ALTER TABLE organizational_unit ADD network_settings_id INT DEFAULT NULL, ADD path VARCHAR(255) 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)');
|
||||
}
|
||||
|
||||
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_749AEB2D9B9A36D0');
|
||||
$this->addSql('DROP TABLE network_settings');
|
||||
$this->addSql('DROP INDEX IDX_749AEB2D9B9A36D0 ON organizational_unit');
|
||||
$this->addSql('ALTER TABLE organizational_unit DROP network_settings_id, DROP path');
|
||||
}
|
||||
}
|
|
@ -1,35 +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 Version20240524083309 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 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('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');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE user_organizational_unit DROP FOREIGN KEY FK_5E59845FA76ED395');
|
||||
$this->addSql('ALTER TABLE user_organizational_unit DROP FOREIGN KEY FK_5E59845FFB84408A');
|
||||
$this->addSql('DROP TABLE user_organizational_unit');
|
||||
}
|
||||
}
|
|
@ -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 Version20240527103936 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 user_group CHANGE roles permissions JSON NOT NULL COMMENT \'(DC2Type:json)\'');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_NAME ON user_group (name)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP INDEX UNIQ_IDENTIFIER_NAME ON user_group');
|
||||
$this->addSql('ALTER TABLE user_group CHANGE permissions roles JSON NOT NULL COMMENT \'(DC2Type:json)\'');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
<?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 Version20240528093352 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 aulas (idaula INT AUTO_INCREMENT NOT NULL, nombreaula VARCHAR(255) NOT NULL, idcentro INT NOT NULL, urlfoto VARCHAR(255) NOT NULL, cagnon TINYINT(1) NOT NULL, pizarra TINYINT(1) NOT NULL, grupoid INT NOT NULL, ubicacion VARCHAR(255) NOT NULL, comentarios VARCHAR(255) NOT NULL, puestos INT NOT NULL, horaresevini TINYINT(1) NOT NULL, horaresevfin TINYINT(1) NOT NULL, modomul TINYINT(1) NOT NULL, ipmul VARCHAR(255) NOT NULL, pormul VARCHAR(255) NOT NULL, velmul VARCHAR(255) NOT NULL, router VARCHAR(255) NOT NULL, netmask VARCHAR(255) NOT NULL, dns VARCHAR(255) NOT NULL, proxy VARCHAR(255) NOT NULL, ntp VARCHAR(255) NOT NULL, modp2p VARCHAR(255) NOT NULL, timep2p VARCHAR(255) NOT NULL, validacion TINYINT(1) NOT NULL, paginalogin VARCHAR(255) NOT NULL, paginavalidacion VARCHAR(255) NOT NULL, inremotepc VARCHAR(255) NOT NULL, oglivedir VARCHAR(255) NOT NULL, PRIMARY KEY(idaula)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE centros (idcentro INT AUTO_INCREMENT NOT NULL, nombrecentro VARCHAR(255) NOT NULL, identidad INT NOT NULL, comentarios VARCHAR(255) DEFAULT NULL, directorio VARCHAR(255) DEFAULT NULL, PRIMARY KEY(idcentro)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE client (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, name VARCHAR(255) DEFAULT NULL, serial_number VARCHAR(255) DEFAULT NULL, netiface VARCHAR(255) DEFAULT NULL, net_driver VARCHAR(255) DEFAULT NULL, mac VARCHAR(255) DEFAULT NULL, ip VARCHAR(255) DEFAULT NULL, status VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_C7440455D17F50A6 (uuid), INDEX IDX_C7440455FB84408A (organizational_unit_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$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 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_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');
|
||||
$this->addSql('ALTER TABLE user_group_user ADD CONSTRAINT FK_3AE4BD51ED93D47 FOREIGN KEY (user_group_id) REFERENCES user_group (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE user_group_user ADD CONSTRAINT FK_3AE4BD5A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE');
|
||||
}
|
||||
|
||||
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_C7440455FB84408A');
|
||||
$this->addSql('ALTER TABLE organizational_unit DROP FOREIGN KEY FK_749AEB2D727ACA70');
|
||||
$this->addSql('ALTER TABLE organizational_unit DROP FOREIGN KEY FK_749AEB2D9B9A36D0');
|
||||
$this->addSql('ALTER TABLE user_organizational_unit DROP FOREIGN KEY FK_5E59845FA76ED395');
|
||||
$this->addSql('ALTER TABLE user_organizational_unit DROP FOREIGN KEY FK_5E59845FFB84408A');
|
||||
$this->addSql('ALTER TABLE user_group_user DROP FOREIGN KEY FK_3AE4BD51ED93D47');
|
||||
$this->addSql('ALTER TABLE user_group_user DROP FOREIGN KEY FK_3AE4BD5A76ED395');
|
||||
$this->addSql('DROP TABLE aulas');
|
||||
$this->addSql('DROP TABLE centros');
|
||||
$this->addSql('DROP TABLE client');
|
||||
$this->addSql('DROP TABLE gruposordenadores');
|
||||
$this->addSql('DROP TABLE network_settings');
|
||||
$this->addSql('DROP TABLE ordenadores');
|
||||
$this->addSql('DROP TABLE organizational_unit');
|
||||
$this->addSql('DROP TABLE refresh_tokens');
|
||||
$this->addSql('DROP TABLE user');
|
||||
$this->addSql('DROP TABLE user_organizational_unit');
|
||||
$this->addSql('DROP TABLE user_group');
|
||||
$this->addSql('DROP TABLE user_group_user');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
<?php
|
||||
|
||||
namespace App\Command\Migration;
|
||||
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Migration\Aulas;
|
||||
use App\Entity\Migration\Centros;
|
||||
use App\Entity\Migration\Gruposordenadores;
|
||||
use App\Entity\Migration\Ordenadores;
|
||||
use App\Entity\NetworkSettings;
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
#[AsCommand(name: 'opengnsys:migration:organizational-unit', description: 'Migration data to new entities')]
|
||||
class MigrateOrganizationalUnitCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly EntityManagerInterface $entityManagerSlave
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$centers = $this->entityManagerSlave->getRepository(Centros::class)->findAll();
|
||||
$rooms = $this->entityManagerSlave->getRepository(Aulas::class)->findAll();
|
||||
$pcGroups = $this->entityManagerSlave->getRepository(Gruposordenadores::class)->findAll();
|
||||
$pcs = $this->entityManagerSlave->getRepository(Ordenadores::class)->findAll();
|
||||
|
||||
$organizationalUnitRepository = $this->entityManager->getRepository(OrganizationalUnit::class);
|
||||
$clientRepository = $this->entityManager->getRepository(Client::class);
|
||||
|
||||
/** Centros **/
|
||||
$output->writeln("CENTROS TOTAL: ". count($centers));
|
||||
foreach ($centers as $center){
|
||||
$centerOrganizationalUnit = null;
|
||||
$centerOrganizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $center->getIdcentro()]);
|
||||
if(!$centerOrganizationalUnit){
|
||||
$centerOrganizationalUnit = new OrganizationalUnit();
|
||||
$centerOrganizationalUnit->setMigrationId($center->getIdcentro());
|
||||
$centerOrganizationalUnit->setName($center->getNombrecentro());
|
||||
$centerOrganizationalUnit->setComments($center->getComentarios());
|
||||
$this->entityManager->persist($centerOrganizationalUnit);
|
||||
}
|
||||
}
|
||||
$this->entityManager->flush();
|
||||
|
||||
/** Aulas **/
|
||||
$output->writeln("AULAS TOTAL: ". count($rooms));
|
||||
foreach ($rooms as $room){
|
||||
$roomOrganizationalUnit = null;
|
||||
$roomOrganizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $room->getIdaula()]);
|
||||
if(!$roomOrganizationalUnit){
|
||||
$roomOrganizationalUnit = new OrganizationalUnit();
|
||||
$roomOrganizationalUnit->setMigrationId($room->getIdaula());
|
||||
$roomOrganizationalUnit->setName($room->getNombreaula());
|
||||
$roomOrganizationalUnitParent = $organizationalUnitRepository->findOneBy(['migrationId' => $room->getIdcentro()]);
|
||||
$roomOrganizationalUnit->setParent($roomOrganizationalUnitParent);
|
||||
$this->entityManager->persist($roomOrganizationalUnit);
|
||||
}
|
||||
|
||||
$networkSettings = $roomOrganizationalUnit->getNetworkSettings();
|
||||
if(!$networkSettings){
|
||||
$networkSettings = new NetworkSettings();
|
||||
$roomOrganizationalUnit->setNetworkSettings($networkSettings);
|
||||
$this->entityManager->persist($networkSettings);
|
||||
}
|
||||
$networkSettings->setProxy($room->getProxy());
|
||||
$networkSettings->setDns($room->getDns());
|
||||
$networkSettings->setNetmask($room->getNetmask());
|
||||
$networkSettings->setRouter($room->getRouter());
|
||||
$networkSettings->setNtp($room->getNtp());
|
||||
$networkSettings->setP2pTime($room->getTimep2p());
|
||||
$networkSettings->setP2pMode($room->getModp2p());
|
||||
$networkSettings->setMcastIp($room->getIpmul());
|
||||
$networkSettings->setMcastSpeed($room->getVelmul());
|
||||
$networkSettings->setMcastPort($room->getPormul());
|
||||
$networkSettings->setMcastMode($room->getModomul());
|
||||
}
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
/** Grupo Ordenador **/
|
||||
$output->writeln("GRUPOS ORDENADORES ". count($rooms));
|
||||
foreach ($pcGroups as $group){
|
||||
$groupPcOrganizationalUnit = null;
|
||||
$migrateParentId = ($group->getGrupoid() == 0) ? $group->getIdaula() : $group->getGrupoid();
|
||||
$groupPcOrganizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $group->getIdgrupo()]);
|
||||
if(!$groupPcOrganizationalUnit){
|
||||
$groupPcOrganizationalUnit = new OrganizationalUnit();
|
||||
$groupPcOrganizationalUnit->setMigrationId($group->getIdgrupo());
|
||||
$groupPcOrganizationalUnit->setName($group->getNombregrupoordenador());
|
||||
$groupPcOrganizationalUnit->setComments($group->getComentarios());
|
||||
$groupPcOrganizationalUnitParent = $organizationalUnitRepository->findOneBy(['migrationId' => $migrateParentId]);
|
||||
$groupPcOrganizationalUnit->setParent($groupPcOrganizationalUnitParent);
|
||||
$this->entityManager->persist($groupPcOrganizationalUnit);
|
||||
}
|
||||
}
|
||||
$this->entityManager->flush();
|
||||
|
||||
/** Ordenadores **/
|
||||
foreach ($pcs as $pc){
|
||||
$newClient = $clientRepository->findOneBy(['migrationId' => $pc->getIdordenador()]);
|
||||
if(!$newClient){
|
||||
$newClient = new Client();
|
||||
$newClient->setMigrationId($pc->getIdordenador());
|
||||
$this->entityManager->persist($newClient);
|
||||
}
|
||||
$newClient->setName($pc->getNombreordenador());
|
||||
$newClient->setSerialNumber($pc->getNumserie());
|
||||
$newClient->setNetiface($pc->getNetiface());
|
||||
$newClient->setNetdriver($pc->getNetdriver());
|
||||
$newClient->setMac($pc->getMac());
|
||||
$newClient->setIp($pc->getIp());
|
||||
//$client->setStatus();
|
||||
//$newClient->setCache($pc->getCache());
|
||||
//$newClient->setIdproautoexec($pc->getIdproautoexec());
|
||||
//$newClient->setOglive($pc->getOglivedir());
|
||||
|
||||
// Netboot
|
||||
|
||||
//$migrationId = ""
|
||||
|
||||
// HardwareProfile
|
||||
//$hardwareProfile = $hardwareProfileRepository->findOneBy(['migrationId' => $pc->getIdperfilhard()]);
|
||||
//$newClient->setHardwareProfile($hardwareProfile);
|
||||
|
||||
// Menu
|
||||
//$menu = $menuRepository->findOneBy(['migrationId' => $pc->getIdmenu()]);
|
||||
//$newClient->setMenu($menu);
|
||||
|
||||
// Repository
|
||||
//$repository = $repositoryRepository->findOneBy(['migrationId' => $pc->getIdrepositorio()]);
|
||||
//$newClient->setRepository($repository);
|
||||
|
||||
// OrganizationalUnit
|
||||
$migrationId = $pc->getGrupoid() == 0 ? $pc->getIdaula() : $pc->getGrupoid();
|
||||
$organizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $migrationId]);
|
||||
$newClient->setOrganizationalUnit($organizationalUnit);
|
||||
|
||||
}
|
||||
$this->entityManager->flush();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -5,36 +5,17 @@ namespace App\DataFixtures;
|
|||
use App\Factory\UserFactory;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
|
||||
class AppFixtures extends Fixture
|
||||
{
|
||||
CONST ADMIN_USER = 'ogadmin';
|
||||
|
||||
|
||||
public function __construct(
|
||||
private readonly KernelInterface $kernel,
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
UserFactory::createOne(['username' => self::ADMIN_USER]);
|
||||
|
||||
$application = new Application($this->kernel);
|
||||
|
||||
$input = new ArrayInput([
|
||||
'command' => 'app:load-default-user-groups'
|
||||
]);
|
||||
|
||||
$output = new BufferedOutput();
|
||||
$application->run($input, $output);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,33 @@
|
|||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
class OrganizationalUnitInput
|
||||
{
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
final class OrganizationalUnitInput
|
||||
{
|
||||
#[Assert\NotBlank]
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?string $name = null;
|
||||
|
||||
public function __construct(?OrganizationalUnit $organizationalUnit = null)
|
||||
{
|
||||
if (!$organizationalUnit) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->name = $organizationalUnit->getName();
|
||||
}
|
||||
|
||||
public function createOrUpdateEntity(?OrganizationalUnit $organizationalUnit = null): OrganizationalUnit
|
||||
{
|
||||
if (!$organizationalUnit) {
|
||||
$organizationalUnit = new OrganizationalUnit();
|
||||
}
|
||||
|
||||
$organizationalUnit->setName($this->name);
|
||||
|
||||
return $organizationalUnit;
|
||||
}
|
||||
}
|
|
@ -70,7 +70,10 @@ final class UserInput
|
|||
$user->setPassword($this->password);
|
||||
}
|
||||
|
||||
//$user->setAllowedOrganizationalUnits($this->allowedOrganizationalUnits);
|
||||
foreach ($this->allowedOrganizationalUnits as $allowedOrganizationalUnit) {
|
||||
$allowedOrganizationalUnitToAdd[] = $allowedOrganizationalUnit->getEntity();
|
||||
}
|
||||
$user->setAllowedOrganizationalUnits( $allowedOrganizationalUnitToAdd ?? [] );
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
|
|
@ -10,20 +10,21 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
abstract class AbstractOutput
|
||||
{
|
||||
#[ApiProperty(identifier: true)]
|
||||
#[Groups(['default'])]
|
||||
#[Groups('default')]
|
||||
public UuidInterface $uuid;
|
||||
|
||||
#[ApiProperty(identifier: false)]
|
||||
#[Groups(['default'])]
|
||||
#[Groups('default')]
|
||||
public int $id;
|
||||
|
||||
public function __construct(private readonly AbstractEntity $entity)
|
||||
{
|
||||
$this->uuid = $entity->getUuid();
|
||||
$this->id = $entity->getId();
|
||||
$this->uuid = $entity->getUuid();
|
||||
}
|
||||
|
||||
public function getEntity(): AbstractEntity
|
||||
#[ApiProperty(readable: false)]
|
||||
public function getEntity(): ?AbstractEntity
|
||||
{
|
||||
return $this->entity;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,28 @@
|
|||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
class OrganizationalUnitOutput
|
||||
{
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
#[Get(shortName: 'OrganizationalUnit')]
|
||||
final class OrganizationalUnitOutput extends AbstractOutput
|
||||
{
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public string $name;
|
||||
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public \DateTime $createAt;
|
||||
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public ?string $createBy = null;
|
||||
|
||||
public function __construct(OrganizationalUnit $organizationalUnit)
|
||||
{
|
||||
parent::__construct($organizationalUnit);
|
||||
|
||||
$this->name = $organizationalUnit->getName();
|
||||
$this->createAt = $organizationalUnit->getCreatedAt();
|
||||
$this->createBy = $organizationalUnit->getCreatedBy();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\ClientRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ClientRepository::class)]
|
||||
class Client extends AbstractEntity
|
||||
{
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $name = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $serialNumber = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $netiface = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $netDriver = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $mac = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $ip = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $status = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'clients')]
|
||||
private ?OrganizationalUnit $organizationalUnit = null;
|
||||
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName(?string $name): static
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSerialNumber(): ?string
|
||||
{
|
||||
return $this->serialNumber;
|
||||
}
|
||||
|
||||
public function setSerialNumber(?string $serialNumber): static
|
||||
{
|
||||
$this->serialNumber = $serialNumber;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNetiface(): ?string
|
||||
{
|
||||
return $this->netiface;
|
||||
}
|
||||
|
||||
public function setNetiface(?string $netiface): static
|
||||
{
|
||||
$this->netiface = $netiface;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNetDriver(): ?string
|
||||
{
|
||||
return $this->netDriver;
|
||||
}
|
||||
|
||||
public function setNetDriver(string $netDriver): static
|
||||
{
|
||||
$this->netDriver = $netDriver;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMac(): ?string
|
||||
{
|
||||
return $this->mac;
|
||||
}
|
||||
|
||||
public function setMac(?string $mac): static
|
||||
{
|
||||
$this->mac = $mac;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIp(): ?string
|
||||
{
|
||||
return $this->ip;
|
||||
}
|
||||
|
||||
public function setIp(?string $ip): static
|
||||
{
|
||||
$this->ip = $ip;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStatus(): ?string
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function setStatus(?string $status): static
|
||||
{
|
||||
$this->status = $status;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOrganizationalUnit(): ?OrganizationalUnit
|
||||
{
|
||||
return $this->organizationalUnit;
|
||||
}
|
||||
|
||||
public function setOrganizationalUnit(?OrganizationalUnit $organizationalUnit): static
|
||||
{
|
||||
$this->organizationalUnit = $organizationalUnit;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,753 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity\Migration;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
class Aulas
|
||||
{
|
||||
#[ORM\Column(length: 255)]
|
||||
private string $nombreaula = '';
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?int $idcentro = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private string $urlfoto;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $cagnon = false;
|
||||
|
||||
#[ORM\Column]
|
||||
private bool $pizarra = false;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?int $grupoid = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $ubicacion = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $comentarios = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $puestos = 0;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $horaresevini = false;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $horaresevfin = false;
|
||||
|
||||
#[ORM\Column]
|
||||
private bool $modomul;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private $ipmul;
|
||||
|
||||
#[ORM\Column]
|
||||
private $pormul;
|
||||
|
||||
#[ORM\Column]
|
||||
private $velmul = '70';
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $router = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $netmask = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $dns = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $proxy = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $ntp = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $modp2p = 'peer';
|
||||
|
||||
#[ORM\Column]
|
||||
private $timep2p = '60';
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $validacion = false;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private $paginalogin;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private $paginavalidacion;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private $inremotepc = '0';
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private $oglivedir = 'ogLive';
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
protected ?int $idaula = null;
|
||||
|
||||
/**
|
||||
* Set nombreaula.
|
||||
*
|
||||
* @param string $nombreaula
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setNombreaula($nombreaula)
|
||||
{
|
||||
$this->nombreaula = $nombreaula;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get nombreaula.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNombreaula()
|
||||
{
|
||||
return $this->nombreaula;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set idcentro.
|
||||
*
|
||||
* @param int $idcentro
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setIdcentro($idcentro)
|
||||
{
|
||||
$this->idcentro = $idcentro;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get idcentro.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getIdcentro()
|
||||
{
|
||||
return $this->idcentro;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set urlfoto.
|
||||
*
|
||||
* @param string|null $urlfoto
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setUrlfoto($urlfoto = null)
|
||||
{
|
||||
$this->urlfoto = $urlfoto;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get urlfoto.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getUrlfoto()
|
||||
{
|
||||
return $this->urlfoto;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cagnon.
|
||||
*
|
||||
* @param bool|null $cagnon
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setCagnon($cagnon = null)
|
||||
{
|
||||
$this->cagnon = $cagnon;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cagnon.
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getCagnon()
|
||||
{
|
||||
return $this->cagnon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set pizarra.
|
||||
*
|
||||
* @param bool|null $pizarra
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setPizarra($pizarra = null)
|
||||
{
|
||||
$this->pizarra = $pizarra;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pizarra.
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getPizarra()
|
||||
{
|
||||
return $this->pizarra;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set grupoid.
|
||||
*
|
||||
* @param int|null $grupoid
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setGrupoid($grupoid = null)
|
||||
{
|
||||
$this->grupoid = $grupoid;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get grupoid.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getGrupoid()
|
||||
{
|
||||
return $this->grupoid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ubicacion.
|
||||
*
|
||||
* @param string|null $ubicacion
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setUbicacion($ubicacion = null)
|
||||
{
|
||||
$this->ubicacion = $ubicacion;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ubicacion.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getUbicacion()
|
||||
{
|
||||
return $this->ubicacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set comentarios.
|
||||
*
|
||||
* @param string|null $comentarios
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setComentarios($comentarios = null)
|
||||
{
|
||||
$this->comentarios = $comentarios;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get comentarios.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getComentarios()
|
||||
{
|
||||
return $this->comentarios;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set puestos.
|
||||
*
|
||||
* @param int|null $puestos
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setPuestos($puestos = null)
|
||||
{
|
||||
$this->puestos = $puestos;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get puestos.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getPuestos()
|
||||
{
|
||||
return $this->puestos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set horaresevini.
|
||||
*
|
||||
* @param bool|null $horaresevini
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setHoraresevini($horaresevini = null)
|
||||
{
|
||||
$this->horaresevini = $horaresevini;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get horaresevini.
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getHoraresevini()
|
||||
{
|
||||
return $this->horaresevini;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set horaresevfin.
|
||||
*
|
||||
* @param bool|null $horaresevfin
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setHoraresevfin($horaresevfin = null)
|
||||
{
|
||||
$this->horaresevfin = $horaresevfin;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get horaresevfin.
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getHoraresevfin()
|
||||
{
|
||||
return $this->horaresevfin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set modomul.
|
||||
*
|
||||
* @param bool $modomul
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setModomul($modomul)
|
||||
{
|
||||
$this->modomul = $modomul;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get modomul.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getModomul()
|
||||
{
|
||||
return $this->modomul;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ipmul.
|
||||
*
|
||||
* @param string $ipmul
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setIpmul($ipmul)
|
||||
{
|
||||
$this->ipmul = $ipmul;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ipmul.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIpmul()
|
||||
{
|
||||
return $this->ipmul;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set pormul.
|
||||
*
|
||||
* @param int $pormul
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setPormul($pormul)
|
||||
{
|
||||
$this->pormul = $pormul;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pormul.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPormul()
|
||||
{
|
||||
return $this->pormul;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set velmul.
|
||||
*
|
||||
* @param int $velmul
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setVelmul($velmul)
|
||||
{
|
||||
$this->velmul = $velmul;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get velmul.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getVelmul()
|
||||
{
|
||||
return $this->velmul;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set router.
|
||||
*
|
||||
* @param string|null $router
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setRouter($router = null)
|
||||
{
|
||||
$this->router = $router;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get router.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getRouter()
|
||||
{
|
||||
return $this->router;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set netmask.
|
||||
*
|
||||
* @param string|null $netmask
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setNetmask($netmask = null)
|
||||
{
|
||||
$this->netmask = $netmask;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get netmask.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getNetmask()
|
||||
{
|
||||
return $this->netmask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set dns.
|
||||
*
|
||||
* @param string|null $dns
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setDns($dns = null)
|
||||
{
|
||||
$this->dns = $dns;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dns.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDns()
|
||||
{
|
||||
return $this->dns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set proxy.
|
||||
*
|
||||
* @param string|null $proxy
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setProxy($proxy = null)
|
||||
{
|
||||
$this->proxy = $proxy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get proxy.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getProxy()
|
||||
{
|
||||
return $this->proxy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ntp.
|
||||
*
|
||||
* @param string|null $ntp
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setNtp($ntp = null)
|
||||
{
|
||||
$this->ntp = $ntp;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ntp.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getNtp()
|
||||
{
|
||||
return $this->ntp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set modp2p.
|
||||
*
|
||||
* @param string|null $modp2p
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setModp2p($modp2p = null)
|
||||
{
|
||||
$this->modp2p = $modp2p;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get modp2p.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getModp2p()
|
||||
{
|
||||
return $this->modp2p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set timep2p.
|
||||
*
|
||||
* @param int $timep2p
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setTimep2p($timep2p)
|
||||
{
|
||||
$this->timep2p = $timep2p;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get timep2p.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTimep2p()
|
||||
{
|
||||
return $this->timep2p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set validacion.
|
||||
*
|
||||
* @param bool|null $validacion
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setValidacion($validacion = null)
|
||||
{
|
||||
$this->validacion = $validacion;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get validacion.
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getValidacion()
|
||||
{
|
||||
return $this->validacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set paginalogin.
|
||||
*
|
||||
* @param string|null $paginalogin
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setPaginalogin($paginalogin = null)
|
||||
{
|
||||
$this->paginalogin = $paginalogin;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get paginalogin.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPaginalogin()
|
||||
{
|
||||
return $this->paginalogin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set paginavalidacion.
|
||||
*
|
||||
* @param string|null $paginavalidacion
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setPaginavalidacion($paginavalidacion = null)
|
||||
{
|
||||
$this->paginavalidacion = $paginavalidacion;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get paginavalidacion.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPaginavalidacion()
|
||||
{
|
||||
return $this->paginavalidacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set inremotepc.
|
||||
*
|
||||
* @param bool|null $inremotepc
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setInremotepc($inremotepc = null)
|
||||
{
|
||||
$this->inremotepc = $inremotepc;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get inremotepc.
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getInremotepc()
|
||||
{
|
||||
return $this->inremotepc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set oglivedir.
|
||||
*
|
||||
* @param string $oglivedir
|
||||
*
|
||||
* @return Aulas
|
||||
*/
|
||||
public function setOglivedir($oglivedir)
|
||||
{
|
||||
$this->oglivedir = $oglivedir;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get oglivedir.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOglivedir()
|
||||
{
|
||||
return $this->oglivedir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get idaula.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getIdaula()
|
||||
{
|
||||
return $this->idaula;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity\Migration;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
class Centros
|
||||
{
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $nombrecentro = '';
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $identidad;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $comentarios = '';
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $directorio = '';
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
protected ?int $idcentro = null;
|
||||
|
||||
/**
|
||||
* Set nombrecentro.
|
||||
*
|
||||
* @param string $nombrecentro
|
||||
*
|
||||
* @return Centros
|
||||
*/
|
||||
public function setNombrecentro($nombrecentro)
|
||||
{
|
||||
$this->nombrecentro = $nombrecentro;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get nombrecentro.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNombrecentro()
|
||||
{
|
||||
return $this->nombrecentro;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set identidad.
|
||||
*
|
||||
* @param int|null $identidad
|
||||
*
|
||||
* @return Centros
|
||||
*/
|
||||
public function setIdentidad($identidad = null)
|
||||
{
|
||||
$this->identidad = $identidad;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get identidad.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getIdentidad()
|
||||
{
|
||||
return $this->identidad;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set comentarios.
|
||||
*
|
||||
* @param string|null $comentarios
|
||||
*
|
||||
* @return Centros
|
||||
*/
|
||||
public function setComentarios($comentarios = null)
|
||||
{
|
||||
$this->comentarios = $comentarios;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get comentarios.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getComentarios()
|
||||
{
|
||||
return $this->comentarios;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set directorio.
|
||||
*
|
||||
* @param string|null $directorio
|
||||
*
|
||||
* @return Centros
|
||||
*/
|
||||
public function setDirectorio($directorio = null)
|
||||
{
|
||||
$this->directorio = $directorio;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get directorio.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDirectorio()
|
||||
{
|
||||
return $this->directorio;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get idcentro.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getIdcentro()
|
||||
{
|
||||
return $this->idcentro;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity\Migration;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
class Gruposordenadores
|
||||
{
|
||||
#[ORM\Column(length: 255)]
|
||||
private $nombregrupoordenador = '';
|
||||
|
||||
#[ORM\Column]
|
||||
private $idaula = '0';
|
||||
|
||||
#[ORM\Column]
|
||||
private $grupoid;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $comentarios = null;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
protected ?int $idgrupo = null;
|
||||
|
||||
|
||||
/**
|
||||
* Set nombregrupoordenador.
|
||||
*
|
||||
* @param string $nombregrupoordenador
|
||||
*
|
||||
* @return Gruposordenadores
|
||||
*/
|
||||
public function setNombregrupoordenador($nombregrupoordenador)
|
||||
{
|
||||
$this->nombregrupoordenador = $nombregrupoordenador;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get nombregrupoordenador.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNombregrupoordenador()
|
||||
{
|
||||
return $this->nombregrupoordenador;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set idaula.
|
||||
*
|
||||
* @param int $idaula
|
||||
*
|
||||
* @return Gruposordenadores
|
||||
*/
|
||||
public function setIdaula($idaula)
|
||||
{
|
||||
$this->idaula = $idaula;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get idaula.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getIdaula()
|
||||
{
|
||||
return $this->idaula;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set grupoid.
|
||||
*
|
||||
* @param int|null $grupoid
|
||||
*
|
||||
* @return Gruposordenadores
|
||||
*/
|
||||
public function setGrupoid($grupoid = null)
|
||||
{
|
||||
$this->grupoid = $grupoid;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get grupoid.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getGrupoid()
|
||||
{
|
||||
return $this->grupoid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set comentarios.
|
||||
*
|
||||
* @param string|null $comentarios
|
||||
*
|
||||
* @return Gruposordenadores
|
||||
*/
|
||||
public function setComentarios($comentarios = null)
|
||||
{
|
||||
$this->comentarios = $comentarios;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get comentarios.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getComentarios()
|
||||
{
|
||||
return $this->comentarios;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get idgrupo.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getIdgrupo()
|
||||
{
|
||||
return $this->idgrupo;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,663 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity\Migration;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
class Ordenadores
|
||||
{
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $nombreordenador;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $numserie;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $ip;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $mac;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
private $idaula;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
private $idperfilhard;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
private $idrepositorio;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
private $grupoid;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
private $idmenu;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
private $cache;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $router;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $mascara;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $idproautoexec = '0';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $arranque = '00unknown';
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $netiface = 'eth0';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $netdriver = 'generic';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $fotoord = 'fotoordenador.gif';
|
||||
|
||||
/**
|
||||
* @var bool|null
|
||||
*/
|
||||
private $validacion = '0';
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $paginalogin;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $paginavalidacion;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $agentkey;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $oglivedir = 'ogLive';
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
protected ?int $idordenador = null;
|
||||
|
||||
|
||||
/**
|
||||
* Set nombreordenador.
|
||||
*
|
||||
* @param string|null $nombreordenador
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setNombreordenador($nombreordenador = null)
|
||||
{
|
||||
$this->nombreordenador = $nombreordenador;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get nombreordenador.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getNombreordenador()
|
||||
{
|
||||
return $this->nombreordenador;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set numserie.
|
||||
*
|
||||
* @param string|null $numserie
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setNumserie($numserie = null)
|
||||
{
|
||||
$this->numserie = $numserie;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get numserie.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getNumserie()
|
||||
{
|
||||
return $this->numserie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ip.
|
||||
*
|
||||
* @param string $ip
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setIp($ip)
|
||||
{
|
||||
$this->ip = $ip;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ip.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIp()
|
||||
{
|
||||
return $this->ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set mac.
|
||||
*
|
||||
* @param string|null $mac
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setMac($mac = null)
|
||||
{
|
||||
$this->mac = $mac;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mac.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMac()
|
||||
{
|
||||
return $this->mac;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set idaula.
|
||||
*
|
||||
* @param int|null $idaula
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setIdaula($idaula = null)
|
||||
{
|
||||
$this->idaula = $idaula;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get idaula.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getIdaula()
|
||||
{
|
||||
return $this->idaula;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set idperfilhard.
|
||||
*
|
||||
* @param int|null $idperfilhard
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setIdperfilhard($idperfilhard = null)
|
||||
{
|
||||
$this->idperfilhard = $idperfilhard;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get idperfilhard.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getIdperfilhard()
|
||||
{
|
||||
return $this->idperfilhard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set idrepositorio.
|
||||
*
|
||||
* @param int|null $idrepositorio
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setIdrepositorio($idrepositorio = null)
|
||||
{
|
||||
$this->idrepositorio = $idrepositorio;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get idrepositorio.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getIdrepositorio()
|
||||
{
|
||||
return $this->idrepositorio;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set grupoid.
|
||||
*
|
||||
* @param int|null $grupoid
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setGrupoid($grupoid = null)
|
||||
{
|
||||
$this->grupoid = $grupoid;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get grupoid.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getGrupoid()
|
||||
{
|
||||
return $this->grupoid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set idmenu.
|
||||
*
|
||||
* @param int|null $idmenu
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setIdmenu($idmenu = null)
|
||||
{
|
||||
$this->idmenu = $idmenu;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get idmenu.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getIdmenu()
|
||||
{
|
||||
return $this->idmenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cache.
|
||||
*
|
||||
* @param int|null $cache
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setCache($cache = null)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cache.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getCache()
|
||||
{
|
||||
return $this->cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set router.
|
||||
*
|
||||
* @param string $router
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setRouter($router)
|
||||
{
|
||||
$this->router = $router;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get router.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRouter()
|
||||
{
|
||||
return $this->router;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set mascara.
|
||||
*
|
||||
* @param string $mascara
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setMascara($mascara)
|
||||
{
|
||||
$this->mascara = $mascara;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mascara.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMascara()
|
||||
{
|
||||
return $this->mascara;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set idproautoexec.
|
||||
*
|
||||
* @param int $idproautoexec
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setIdproautoexec($idproautoexec)
|
||||
{
|
||||
$this->idproautoexec = $idproautoexec;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get idproautoexec.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getIdproautoexec()
|
||||
{
|
||||
return $this->idproautoexec;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set arranque.
|
||||
*
|
||||
* @param string $arranque
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setArranque($arranque)
|
||||
{
|
||||
$this->arranque = $arranque;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get arranque.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getArranque()
|
||||
{
|
||||
return $this->arranque;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set netiface.
|
||||
*
|
||||
* @param string|null $netiface
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setNetiface($netiface = null)
|
||||
{
|
||||
$this->netiface = $netiface;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get netiface.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getNetiface()
|
||||
{
|
||||
return $this->netiface;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set netdriver.
|
||||
*
|
||||
* @param string $netdriver
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setNetdriver($netdriver)
|
||||
{
|
||||
$this->netdriver = $netdriver;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get netdriver.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNetdriver()
|
||||
{
|
||||
return $this->netdriver;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fotoord.
|
||||
*
|
||||
* @param string $fotoord
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setFotoord($fotoord)
|
||||
{
|
||||
$this->fotoord = $fotoord;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fotoord.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFotoord()
|
||||
{
|
||||
return $this->fotoord;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set validacion.
|
||||
*
|
||||
* @param bool|null $validacion
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setValidacion($validacion = null)
|
||||
{
|
||||
$this->validacion = $validacion;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get validacion.
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getValidacion()
|
||||
{
|
||||
return $this->validacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set paginalogin.
|
||||
*
|
||||
* @param string|null $paginalogin
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setPaginalogin($paginalogin = null)
|
||||
{
|
||||
$this->paginalogin = $paginalogin;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get paginalogin.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPaginalogin()
|
||||
{
|
||||
return $this->paginalogin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set paginavalidacion.
|
||||
*
|
||||
* @param string|null $paginavalidacion
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setPaginavalidacion($paginavalidacion = null)
|
||||
{
|
||||
$this->paginavalidacion = $paginavalidacion;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get paginavalidacion.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPaginavalidacion()
|
||||
{
|
||||
return $this->paginavalidacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set agentkey.
|
||||
*
|
||||
* @param string|null $agentkey
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setAgentkey($agentkey = null)
|
||||
{
|
||||
$this->agentkey = $agentkey;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get agentkey.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getAgentkey()
|
||||
{
|
||||
return $this->agentkey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set oglivedir.
|
||||
*
|
||||
* @param string $oglivedir
|
||||
*
|
||||
* @return Ordenadores
|
||||
*/
|
||||
public function setOglivedir($oglivedir)
|
||||
{
|
||||
$this->oglivedir = $oglivedir;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get oglivedir.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOglivedir()
|
||||
{
|
||||
return $this->oglivedir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get idordenador.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getIdordenador()
|
||||
{
|
||||
return $this->idordenador;
|
||||
}
|
||||
}
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
trait NameableTrait
|
||||
{
|
||||
#[ORM\Column(length: 255)]
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\OrganizationalUnitRepository;
|
||||
use Gedmo\Mapping\Annotation as Gedmo;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Gedmo\Tree\Entity\Repository\MaterializedPathRepository;
|
||||
|
||||
#[Gedmo\Tree(type: 'materialized-path')]
|
||||
#[ORM\Entity(repositoryClass: OrganizationalUnitRepository::class)]
|
||||
#[Gedmo\Tree(type: 'materializedPath')]
|
||||
#[ORM\Entity(repositoryClass: MaterializedPathRepository::class)]
|
||||
class OrganizationalUnit extends AbstractEntity
|
||||
{
|
||||
use NameableTrait;
|
||||
|
@ -20,10 +20,19 @@ class OrganizationalUnit extends AbstractEntity
|
|||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $comments = null;
|
||||
|
||||
#[Gedmo\TreePath(separator: '/', appendId: true)]
|
||||
#[Gedmo\TreePath(separator: '/', appendId: false, startsWithSeparator: true, endsWithSeparator: false)]
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $path = null;
|
||||
|
||||
#[Gedmo\TreeLevel]
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?int $level;
|
||||
|
||||
#[Gedmo\TreePathSource]
|
||||
#[Gedmo\Slug(fields: ['name'])]
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $slug = null;
|
||||
|
||||
#[Gedmo\TreeParent]
|
||||
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'organizationalUnits')]
|
||||
private ?self $parent = null;
|
||||
|
@ -31,7 +40,7 @@ class OrganizationalUnit extends AbstractEntity
|
|||
/**
|
||||
* @var Collection<int, self>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent')]
|
||||
#[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class)]
|
||||
private Collection $organizationalUnits;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'organizationalUnits')]
|
||||
|
@ -43,11 +52,18 @@ class OrganizationalUnit extends AbstractEntity
|
|||
#[ORM\ManyToMany(targetEntity: User::class, mappedBy: 'allowedOrganizationalUnits')]
|
||||
private Collection $users;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Client>
|
||||
*/
|
||||
#[ORM\OneToMany(mappedBy: 'organizationalUnit', targetEntity: Client::class)]
|
||||
private Collection $clients;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->organizationalUnits = new ArrayCollection();
|
||||
$this->users = new ArrayCollection();
|
||||
$this->clients = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
|
@ -86,6 +102,30 @@ class OrganizationalUnit extends AbstractEntity
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getLevel(): ?int
|
||||
{
|
||||
return $this->level;
|
||||
}
|
||||
|
||||
public function setLevel(?int $level): static
|
||||
{
|
||||
$this->level = $level;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSlug(): ?string
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
public function setSlug(?string $slug): static
|
||||
{
|
||||
$this->slug = $slug;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getParent(): ?self
|
||||
{
|
||||
return $this->parent;
|
||||
|
@ -166,4 +206,33 @@ class OrganizationalUnit extends AbstractEntity
|
|||
|
||||
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->setOrganizationalUnit($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeClient(Client $client): static
|
||||
{
|
||||
if ($this->clients->removeElement($client)) {
|
||||
if ($client->getOrganizationalUnit() === $this) {
|
||||
$client->setOrganizationalUnit(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
trait ToggleableTrait
|
||||
{
|
||||
#[ORM\Column(type: 'boolean')]
|
||||
|
|
|
@ -91,7 +91,7 @@ class User extends AbstractEntity implements UserInterface, PasswordAuthenticate
|
|||
|
||||
foreach ($this->getUserGroups() as $userGroup) {
|
||||
if ($userGroup->isEnabled()){
|
||||
$roles = array_merge($roles, $userGroup->getRoles());
|
||||
$roles = array_merge($roles, $userGroup->getPermissions());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,6 +178,17 @@ class User extends AbstractEntity implements UserInterface, PasswordAuthenticate
|
|||
return $this->allowedOrganizationalUnits;
|
||||
}
|
||||
|
||||
public function setAllowedOrganizationalUnits(array $allowedOrganizationalUnits): static
|
||||
{
|
||||
$this->allowedOrganizationalUnits->clear();
|
||||
|
||||
foreach ($allowedOrganizationalUnits as $allowedOrganizationalUnit){
|
||||
$this->addAllowedOrganizationalUnit($allowedOrganizationalUnit);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addAllowedOrganizationalUnit(OrganizationalUnit $allowedOrganizationalUnit): static
|
||||
{
|
||||
if (!$this->allowedOrganizationalUnits->contains($allowedOrganizationalUnit)) {
|
||||
|
|
|
@ -14,11 +14,9 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
#[UniqueEntity(fields: ['name'], message: 'There is already an role with this name')]
|
||||
class UserGroup extends AbstractEntity
|
||||
{
|
||||
use NameableTrait;
|
||||
use ToggleableTrait;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $name = null;
|
||||
|
||||
#[ORM\Column(type: Types::JSON)]
|
||||
private array $permissions = [];
|
||||
|
||||
|
@ -35,18 +33,6 @@ class UserGroup extends AbstractEntity
|
|||
$this->users = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName(string $name): static
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPermissions(): array
|
||||
{
|
||||
return $this->permissions;
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Client;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Client>
|
||||
*/
|
||||
class ClientRepository extends ServiceEntityRepository
|
||||
{
|
||||
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()
|
||||
// ;
|
||||
// }
|
||||
}
|
|
@ -9,35 +9,10 @@ use Doctrine\Persistence\ManagerRegistry;
|
|||
/**
|
||||
* @extends ServiceEntityRepository<OrganizationalUnit>
|
||||
*/
|
||||
class OrganizationalUnitRepository extends ServiceEntityRepository
|
||||
class OrganizationalUnitRepository extends AbstractRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, OrganizationalUnit::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return OrganizationalUnit[] Returns an array of OrganizationalUnit objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('o')
|
||||
// ->andWhere('o.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('o.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?OrganizationalUnit
|
||||
// {
|
||||
// return $this->createQueryBuilder('o')
|
||||
// ->andWhere('o.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
namespace App\State\Processor;
|
||||
|
||||
use ApiPlatform\Metadata\Delete;
|
||||
use ApiPlatform\Metadata\Operation;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use ApiPlatform\Metadata\Put;
|
||||
use ApiPlatform\State\ProcessorInterface;
|
||||
use ApiPlatform\Validator\ValidatorInterface;
|
||||
use App\Dto\Input\OrganizationalUnitInput;
|
||||
use App\Dto\Output\OrganizationalUnitOutput;
|
||||
use App\Repository\OrganizationalUnitRepository;
|
||||
|
||||
class OrganizationalUnitProcessor implements ProcessorInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly OrganizationalUnitRepository $organizationalUnitRepository,
|
||||
private readonly ValidatorInterface $validator
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): OrganizationalUnitOutput|null
|
||||
{
|
||||
switch ($operation){
|
||||
case $operation instanceof Post:
|
||||
case $operation instanceof Put:
|
||||
case $operation instanceof Patch:
|
||||
return $this->processCreateOrUpdate($data, $operation, $uriVariables, $context);
|
||||
case $operation instanceof Delete:
|
||||
return $this->processDelete($data, $operation, $uriVariables, $context);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function processCreateOrUpdate($data, Operation $operation, array $uriVariables = [], array $context = []): OrganizationalUnitOutput
|
||||
{
|
||||
if (!($data instanceof OrganizationalUnitOutput)) {
|
||||
throw new \Exception(sprintf('data is not instance of %s', OrganizationalUnitInput::class));
|
||||
}
|
||||
|
||||
$entity = null;
|
||||
if (isset($uriVariables['uuid'])) {
|
||||
$entity = $this->organizationalUnitRepository->findOneByUuid($uriVariables['uuid']);
|
||||
}
|
||||
|
||||
$organizationalUnit = $data->createOrUpdateEntity($entity);
|
||||
$this->validator->validate($organizationalUnit);
|
||||
$this->organizationalUnitRepository->save($organizationalUnit);
|
||||
|
||||
return new OrganizationalUnitOutput($organizationalUnit);
|
||||
}
|
||||
|
||||
private function processDelete($data, Operation $operation, array $uriVariables = [], array $context = []): null
|
||||
{
|
||||
$user = $this->organizationalUnitRepository->findOneByUuid($uriVariables['uuid']);
|
||||
$this->organizationalUnitRepository->delete($user);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -10,7 +10,6 @@ use ApiPlatform\Metadata\Put;
|
|||
use ApiPlatform\State\ProcessorInterface;
|
||||
use ApiPlatform\Validator\ValidatorInterface;
|
||||
use App\Dto\Input\UserGroupInput;
|
||||
use App\Dto\Input\UserInput;
|
||||
use App\Dto\Output\UserGroupOutput;
|
||||
use App\Repository\UserGroupRepository;
|
||||
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
namespace App\State\Provider;
|
||||
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use ApiPlatform\Metadata\GetCollection;
|
||||
use ApiPlatform\Metadata\Operation;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Put;
|
||||
use ApiPlatform\State\Pagination\TraversablePaginator;
|
||||
use ApiPlatform\State\ProviderInterface;
|
||||
use App\Dto\Input\UserGroupInput;
|
||||
use App\Dto\Output\OrganizationalUnitOutput;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class OrganizationalUnitProvider implements ProviderInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ProviderInterface $collectionProvider,
|
||||
private readonly ProviderInterface $itemProvider
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
|
||||
{
|
||||
switch ($operation){
|
||||
case $operation instanceof GetCollection:
|
||||
return $this->provideCollection($operation, $uriVariables, $context);
|
||||
case $operation instanceof Patch:
|
||||
case $operation instanceof Put:
|
||||
return $this->provideInput($operation, $uriVariables, $context);
|
||||
case $operation instanceof Get:
|
||||
return $this->provideItem($operation, $uriVariables, $context);
|
||||
}
|
||||
}
|
||||
|
||||
private function provideCollection(Operation $operation, array $uriVariables = [], array $context = []): object
|
||||
{
|
||||
$paginator = $this->collectionProvider->provide($operation, $uriVariables, $context);
|
||||
|
||||
$items = new \ArrayObject();
|
||||
foreach ($paginator->getIterator() as $item){
|
||||
$items[] = new OrganizationalUnitOutput($item);
|
||||
}
|
||||
|
||||
return new TraversablePaginator($items, $paginator->getCurrentPage(), $paginator->getItemsPerPage(), $paginator->getTotalItems());
|
||||
}
|
||||
|
||||
public function provideItem(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
|
||||
{
|
||||
$item = $this->itemProvider->provide($operation, $uriVariables, $context);
|
||||
|
||||
if (!$item) {
|
||||
throw new NotFoundHttpException('Organizational unit not found');
|
||||
}
|
||||
|
||||
return new OrganizationalUnitOutput($item);
|
||||
}
|
||||
|
||||
public function provideInput(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
|
||||
{
|
||||
if (isset($uriVariables['uuid'])) {
|
||||
$item = $this->itemProvider->provide($operation, $uriVariables, $context);
|
||||
|
||||
return $item !== null ? new UserGroupInput($item) : null;
|
||||
}
|
||||
|
||||
return new UserGroupInput();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue