Merge pull request 'feature/organizational-unit-hierarchy' (#7) from feature/organizational-unit-hierarchy into main
Reviewed-on: #7pull/8/head
commit
020a731351
2
.env
2
.env
|
@ -26,6 +26,8 @@ APP_SECRET=e95c7f17da15ce1b03d77ad655379c34
|
|||
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
|
||||
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
|
||||
DATABASE_URL="mysql://root:root@ogcore-database:3306/ogcore?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
|
||||
OG_1_DATABASE_URL="mysql://root:root@ogcore-database:3306/ogcore_old_og?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
|
||||
|
||||
#DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8"
|
||||
###< doctrine/doctrine-bundle ###
|
||||
|
||||
|
|
35
README.md
35
README.md
|
@ -68,7 +68,7 @@ docker exec ogcore-php php bin/console doctrine:migrations:migrate --no-interact
|
|||
|
||||
```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
|
||||
docker exec ogcore-php php bin/console app:load-default-user-groups #cargamos los grupos por defecto
|
||||
```
|
||||
|
||||
## UX Api Platform
|
||||
|
@ -105,3 +105,36 @@ Es posible que en momentos de desarrollo, sea necesario volver a cargar la base
|
|||
docker exec ogcore-php php bin/console doctrine:database:drop --force
|
||||
docker exec ogcore-php php bin/console doctrine:database:create
|
||||
```
|
||||
|
||||
## Migraciones de datos
|
||||
|
||||
Para poder migrar los datos desde la base de datos "antigua", previamente necesitamos poder tener un esquema de base de datos con un dump de OpenGnsys. Es decir:
|
||||
|
||||
- Creamos una base de datos temporal simulando una insancia de OpenGnsys 1.1. La solicitaremos al equipo de desarrollo de las universidades
|
||||
- Necesitaremos un dump de la base de datos de OpenGnsys 1.1.
|
||||
|
||||
Mediante doctrine, creamos la base de datos temporal:
|
||||
|
||||
```sh
|
||||
docker exec ogcore-php php bin/console doctrine:database:create --connection=og_1
|
||||
```
|
||||
|
||||

|
||||
|
||||
Aqui podemos ver como tenemos las 2 bases de datos. OgCore es la actual, donde estamos desarrollando, y ogcore_old_og es la base de datos temporal que acabamos de crear.
|
||||
|
||||
Aqui vendria el paso de cargar el dump en dicha base de datos, ya que contiene informacion sensible, no se aloja en el repositorio, por eso tendremos que solicitarla al equipo correspondiente.
|
||||
Una vez tengamos la base de datos cargada, podremos ejecutar las migraciones de datos:
|
||||
|
||||
```sh
|
||||
--- Migraciones de OpenGnsys. ---
|
||||
docker exec ogcore-php php bin/console opengnsys:migration:organizational-unit #cargamos las unidades organizativas
|
||||
docker exec ogcore-php php bin/console opengnsys:migrate-hardware-profiles #cargamos los perfiles de hardware
|
||||
docker exec ogcore-php php bin/console opengnsys:migration:clients #cargamos los clientes
|
||||
```
|
||||
|
||||
## Objetos de interés
|
||||
|
||||
Se ha incluido un .zip con las colecciones de de API de ogCore para poder trabajar, hacer pruebas, y demás en Postman. Para importarlos, tan solo tendremos que ir a la pestaña de importar, y seleccionar el archivo .zip.
|
||||
|
||||
Visualizar [coleccion Postman](swagger-assets/ogCore.postman_collection.zip)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,41 @@
|
|||
resources:
|
||||
App\Entity\Client:
|
||||
processor: App\State\Processor\ClientProcessor
|
||||
input: App\Dto\Input\ClientInput
|
||||
output: App\Dto\Output\ClientOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'client:read']
|
||||
denormalizationContext:
|
||||
groups: ['client:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\ClientProvider
|
||||
filters:
|
||||
- 'api_platform.filter.client.order'
|
||||
- 'api_platform.filter.client.search'
|
||||
- 'api_platform.filter.client.boolean'
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\ClientProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\ClientProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\ClientProvider
|
||||
validationContext:
|
||||
groups: [ 'client:patch' ]
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
change_organizational_units:
|
||||
provider: App\State\Provider\ClientProvider
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\ChangeOrganizationalUnitInput
|
||||
uriTemplate: /clients/change-organizational-units
|
||||
controller: App\Controller\ChangeOrganizationalUnitAction
|
||||
|
||||
properties:
|
||||
App\Entity\Client:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -0,0 +1,31 @@
|
|||
resources:
|
||||
App\Entity\Hardware:
|
||||
processor: App\State\Processor\HardwareProcessor
|
||||
input: App\Dto\Input\HardwareInput
|
||||
output: App\Dto\Output\HardwareOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'hardware:read']
|
||||
denormalizationContext:
|
||||
groups: ['hardware:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\HardwareProvider
|
||||
filters:
|
||||
- 'api_platform.filter.hardware.order'
|
||||
- 'api_platform.filter.hardware.search'
|
||||
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\HardwareProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\HardwareProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\HardwareProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
properties:
|
||||
App\Entity\Hardware:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -0,0 +1,30 @@
|
|||
resources:
|
||||
App\Entity\HardwareProfile:
|
||||
processor: App\State\Processor\HardwareProfileProcessor
|
||||
input: App\Dto\Input\HardwareProfileInput
|
||||
output: App\Dto\Output\HardwareProfileOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'hardware-profile:read']
|
||||
denormalizationContext:
|
||||
groups: ['hardware-profile:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\HardwareProfileProvider
|
||||
filters:
|
||||
- 'api_platform.filter.hardware.order'
|
||||
- 'api_platform.filter.hardware.search'
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\HardwareProfileProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\HardwareProfileProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\HardwareProfileProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
properties:
|
||||
App\Entity\HardwareProfile:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -0,0 +1,31 @@
|
|||
resources:
|
||||
App\Entity\HardwareType:
|
||||
processor: App\State\Processor\HardwareTypeProcessor
|
||||
input: App\Dto\Input\HardwareTypeInput
|
||||
output: App\Dto\Output\HardwareTypeOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'hardware-type:read']
|
||||
denormalizationContext:
|
||||
groups: ['hardware-type:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\HardwareTypeProvider
|
||||
filters:
|
||||
- 'api_platform.filter.hardware_type.order'
|
||||
- 'api_platform.filter.hardware_type.search'
|
||||
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\HardwareTypeProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\HardwareTypeProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\HardwareTypeProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
properties:
|
||||
App\Entity\HardwareType:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -0,0 +1,30 @@
|
|||
resources:
|
||||
App\Entity\Image:
|
||||
processor: App\State\Processor\ImageProcessor
|
||||
input: App\Dto\Input\ImageInput
|
||||
output: App\Dto\Output\ImageOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'image:read']
|
||||
denormalizationContext:
|
||||
groups: ['image:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\ImageProvider
|
||||
filters:
|
||||
- 'api_platform.filter.image.order'
|
||||
- 'api_platform.filter.image.search'
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\ImageProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\ImageProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\ImageProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
properties:
|
||||
App\Entity\Image:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -0,0 +1,30 @@
|
|||
resources:
|
||||
App\Entity\Menu:
|
||||
processor: App\State\Processor\MenuProcessor
|
||||
input: App\Dto\Input\MenuInput
|
||||
output: App\Dto\Output\MenuOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'menu:read']
|
||||
denormalizationContext:
|
||||
groups: ['menu:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\MenuProvider
|
||||
filters:
|
||||
- 'api_platform.filter.menu.order'
|
||||
- 'api_platform.filter.menu.search'
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\MenuProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\MenuProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\MenuProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
properties:
|
||||
App\Entity\Menu:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -0,0 +1,31 @@
|
|||
resources:
|
||||
App\Entity\OperativeSystem:
|
||||
processor: App\State\Processor\OperativeSystemProcessor
|
||||
input: App\Dto\Input\OperativeSystemInput
|
||||
output: App\Dto\Output\OperativeSystemOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'operative-system:read']
|
||||
denormalizationContext:
|
||||
groups: ['operative-system:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\OperativeSystemProvider
|
||||
filters:
|
||||
- 'api_platform.filter.operative_system.order'
|
||||
- 'api_platform.filter.operative_system.search'
|
||||
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\OperativeSystemProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\OperativeSystemProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\OperativeSystemProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
properties:
|
||||
App\Entity\OperativeSystem:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -1,23 +1,36 @@
|
|||
resources:
|
||||
App\Entity\OrganizationalUnit:
|
||||
processor: App\State\Processor\OrganizationalUnitProcessor
|
||||
input: App\Dto\Input\OrganizationalUnitInput
|
||||
output: App\Dto\Output\OrganizationalUnitOutput
|
||||
normalization_context:
|
||||
input: App\Dto\Input\OrganizationalUnitInput
|
||||
normalizationContext:
|
||||
groups: ['default', 'organizational-unit:read']
|
||||
denormalization_context:
|
||||
groups: ['organizational-unit:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\OrganizationalUnitProvider
|
||||
filters:
|
||||
- 'api_platform.filter.organizational_unit.order'
|
||||
- 'api_platform.filter.organizational_unit.search'
|
||||
ApiPlatform\Metadata\Get:
|
||||
security: 'is_granted("ORGANIZATIONAL_UNIT_VIEW", object)'
|
||||
provider: App\State\Provider\OrganizationalUnitProvider
|
||||
securityMessage: 'Sorry, but you are not allowed to access this resource.'
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\OrganizationalUnitProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\OrganizationalUnitProvider
|
||||
validationContext:
|
||||
groups: ['organizational-unit:patch' ]
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
change_parent:
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: false
|
||||
uriTemplate: /organizational-units/{uuid}/change-parent
|
||||
controller: App\Controller\OrganizationalUnitChangeParentAction
|
||||
|
||||
properties:
|
||||
App\Entity\OrganizationalUnit:
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
resources:
|
||||
App\Entity\Partition:
|
||||
processor: App\State\Processor\PartitionProcessor
|
||||
input: App\Dto\Input\PartitionInput
|
||||
output: App\Dto\Output\PartitionOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'partition:read']
|
||||
denormalizationContext:
|
||||
groups: ['partition:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\PartitionProvider
|
||||
filters:
|
||||
- 'api_platform.filter.partition.order'
|
||||
- 'api_platform.filter.partition.search'
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\PartitionProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\PartitionProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\PartitionProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
properties:
|
||||
App\Entity\Partition:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -0,0 +1,31 @@
|
|||
resources:
|
||||
App\Entity\Software:
|
||||
processor: App\State\Processor\SoftwareProcessor
|
||||
input: App\Dto\Input\SoftwareInput
|
||||
output: App\Dto\Output\SoftwareOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'software:read']
|
||||
denormalizationContext:
|
||||
groups: ['software:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\SoftwareProvider
|
||||
filters:
|
||||
- 'api_platform.filter.software.order'
|
||||
- 'api_platform.filter.software.search'
|
||||
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\SoftwareProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\SoftwareProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\SoftwareProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
properties:
|
||||
App\Entity\Software:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -0,0 +1,30 @@
|
|||
resources:
|
||||
App\Entity\SoftwareProfile:
|
||||
processor: App\State\Processor\SoftwareProfileProcessor
|
||||
input: App\Dto\Input\SoftwareProfileInput
|
||||
output: App\Dto\Output\SoftwareProfileOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'software-profile:read']
|
||||
denormalizationContext:
|
||||
groups: ['software-profile:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\SoftwareProfileProvider
|
||||
filters:
|
||||
- 'api_platform.filter.software.order'
|
||||
- 'api_platform.filter.software.search'
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\SoftwareProfileProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\SoftwareProfileProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\SoftwareProfileProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
properties:
|
||||
App\Entity\SoftwareProfile:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -3,13 +3,12 @@ resources:
|
|||
input: App\Dto\Input\UserInput
|
||||
output: App\Dto\Output\UserOutput
|
||||
processor: App\State\Processor\UserProcessor
|
||||
normalization_context:
|
||||
normalizationContext:
|
||||
groups: ['default', 'user:read']
|
||||
denormalization_context:
|
||||
denormalizationContext:
|
||||
groups: ['user:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
security: 'is_granted("ROLE_SUPER_ADMIN")'
|
||||
provider: App\State\Provider\UserProvider
|
||||
filters:
|
||||
- 'api_platform.filter.user.order'
|
||||
|
|
|
@ -4,9 +4,9 @@ resources:
|
|||
processor: App\State\Processor\UserGroupProcessor
|
||||
input: App\Dto\Input\UserGroupInput
|
||||
output: App\Dto\Output\UserGroupOutput
|
||||
normalization_context:
|
||||
normalizationContext:
|
||||
groups: ['default', 'user-group:read']
|
||||
denormalization_context:
|
||||
denormalizationContext:
|
||||
groups: ['user-group:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
|
|
|
@ -4,12 +4,22 @@ api_platform:
|
|||
version: 1.0.0
|
||||
path_segment_name_generator: 'api_platform.path_segment_name_generator.dash'
|
||||
formats:
|
||||
jsonld: ['application/ld+json', 'application/json']
|
||||
jsonld: [ 'application/ld+json' ]
|
||||
jsonhal: [ 'application/hal+json' ]
|
||||
jsonapi: [ 'application/vnd.api+json' ]
|
||||
json: [ 'application/json' ]
|
||||
xml: [ 'application/xml', 'text/xml' ]
|
||||
yaml: [ 'application/x-yaml' ]
|
||||
csv: [ 'text/csv' ]
|
||||
html: [ 'text/html' ]
|
||||
patch_formats:
|
||||
jsonld: ['application/ld+json', 'application/json']
|
||||
mapping:
|
||||
paths: ['%kernel.project_dir%/config/api_platform', '%kernel.project_dir%/src/Dto']
|
||||
use_symfony_listeners: true
|
||||
collection:
|
||||
pagination:
|
||||
items_per_page_parameter_name: 'itemsPerPage'
|
||||
defaults:
|
||||
pagination_client_items_per_page: true
|
||||
denormalization_context:
|
||||
|
|
|
@ -1,24 +1,36 @@
|
|||
doctrine:
|
||||
dbal:
|
||||
url: '%env(resolve:DATABASE_URL)%'
|
||||
profiling_collect_backtrace: '%kernel.debug%'
|
||||
use_savepoints: true
|
||||
mapping_types:
|
||||
enum: string
|
||||
connections:
|
||||
default:
|
||||
url: '%env(resolve:DATABASE_URL)%'
|
||||
profiling_collect_backtrace: '%kernel.debug%'
|
||||
use_savepoints: true
|
||||
mapping_types:
|
||||
enum: string
|
||||
og_1:
|
||||
url: '%env(resolve:OG_1_DATABASE_URL)%'
|
||||
use_savepoints: true
|
||||
default_connection: default
|
||||
|
||||
orm:
|
||||
auto_generate_proxy_classes: true
|
||||
enable_lazy_ghost_objects: true
|
||||
report_fields_where_declared: true
|
||||
validate_xml_mapping: true
|
||||
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
|
||||
auto_mapping: true
|
||||
mappings:
|
||||
App:
|
||||
type: attribute
|
||||
is_bundle: false
|
||||
dir: '%kernel.project_dir%/src/Entity'
|
||||
prefix: 'App\Entity'
|
||||
alias: App
|
||||
default_entity_manager: default
|
||||
entity_managers:
|
||||
default:
|
||||
auto_mapping: true
|
||||
connection: default
|
||||
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
|
||||
report_fields_where_declared: true
|
||||
mappings:
|
||||
App:
|
||||
is_bundle: false
|
||||
type: attribute
|
||||
dir: '%kernel.project_dir%/src/Entity'
|
||||
prefix: 'App\Entity'
|
||||
alias: App
|
||||
|
||||
og_1:
|
||||
connection: og_1
|
||||
|
||||
controller_resolver:
|
||||
auto_mapping: true
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# This file is the entry point to configure your own services.
|
||||
# Files in the packages/ subdirectory configure your dependencies.
|
||||
imports:
|
||||
- { resource: 'services/api_platform.yaml' }
|
||||
|
||||
# Put parameters here that don't need to change on each machine where the app is deployed
|
||||
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
|
||||
parameters:
|
||||
|
||||
services:
|
||||
|
@ -11,8 +9,6 @@ services:
|
|||
autowire: true # Automatically injects dependencies in your services.
|
||||
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
|
||||
|
||||
# makes classes in src/ available to be used as services
|
||||
# this creates a service per class whose id is the fully-qualified class name
|
||||
App\:
|
||||
resource: '../src/'
|
||||
exclude:
|
||||
|
@ -20,6 +16,11 @@ services:
|
|||
- '../src/Entity/'
|
||||
- '../src/Kernel.php'
|
||||
|
||||
App\Doctrine\UserAllowedOrganizationalUnitExtension:
|
||||
tags:
|
||||
- { name: api_platform.doctrine.orm.query_extension.collection }
|
||||
- { name: api_platform.doctrine.orm.query_extension.item }
|
||||
|
||||
App\OpenApi\OpenApiFactory:
|
||||
decorates: 'api_platform.openapi.factory'
|
||||
arguments: [ '@App\OpenApi\OpenApiFactory.inner' ]
|
||||
|
@ -39,3 +40,53 @@ services:
|
|||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\ClientProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\HardwareProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\HardwareProfileProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\MenuProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\PartitionProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\OperativeSystemProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\HardwareTypeProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\SoftwareProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\SoftwareProfileProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\ImageProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
|
|
@ -1,40 +1,96 @@
|
|||
services:
|
||||
api_platform.filter.client.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
$properties: { 'id': ~, 'name': ~, 'serialNumber': ~ }
|
||||
$orderParameterName: 'order'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.client.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial', 'serialNumber': 'exact', organizationalUnit.id: 'exact' } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.hardware.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
$properties: { 'id': ~, 'name': ~ }
|
||||
$orderParameterName: 'order'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.hardware.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial' } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.menu.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
$properties: { 'id': ~, 'name': ~, 'title': ~ }
|
||||
$orderParameterName: 'order'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.menu.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'name': 'exact', 'title': 'exact' } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.organizational_unit.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
$properties: { 'id': ~, 'name': ~, 'type': ~ }
|
||||
$orderParameterName: 'order'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.organizational_unit.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { id: 'exact', name: 'partial', type: 'exact', parent.id: 'exact'} ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.partition.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
$properties: { 'id': ~, 'usage': ~ }
|
||||
$orderParameterName: 'order'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.partition.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'usage': 'exact', 'diskNumber': 'exact' } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.user.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
$properties: { 'id' : ~, 'username': ~ }
|
||||
$properties: { 'id': ~, 'username': ~ }
|
||||
$orderParameterName: 'order'
|
||||
tags:
|
||||
- ['api_platform.filter' ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.user.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'username': 'partial' }]
|
||||
tags:
|
||||
- ['api_platform.filter' ]
|
||||
arguments: [ { 'id': 'exact', 'username': 'partial' } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.user.boolean:
|
||||
parent: 'api_platform.doctrine.orm.boolean_filter'
|
||||
arguments: [ { 'enabled': ~ } ]
|
||||
tags:
|
||||
- [ 'api_platform.filter' ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.user_group.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
$properties: { 'id': ~, 'name': ~ }
|
||||
$orderParameterName: 'order'
|
||||
tags:
|
||||
- [ 'api_platform.filter' ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.user_group.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial' } ]
|
||||
tags:
|
||||
- [ 'api_platform.filter' ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.user_group.boolean:
|
||||
parent: 'api_platform.doctrine.orm.boolean_filter'
|
||||
arguments: [ { 'enabled': ~ } ]
|
||||
tags:
|
||||
- [ 'api_platform.filter' ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
|
||||
|
|
|
@ -37,6 +37,10 @@ services:
|
|||
- ./:/var/www/html
|
||||
depends_on:
|
||||
- database
|
||||
environment:
|
||||
XDEBUG_CLIENT_HOST: 127.17.0.1
|
||||
XDEBUG_CLIENT_PORT: 9003
|
||||
PHP_IDE_CONFIG: serverName=ogcore
|
||||
networks:
|
||||
- ogcore-network
|
||||
|
||||
|
|
|
@ -18,3 +18,13 @@ RUN apk add --no-cache bash git jq moreutils openssh rsync yq
|
|||
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/install-php-extensions
|
||||
RUN install-php-extensions sockets
|
||||
|
||||
# Add xdebug
|
||||
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS
|
||||
RUN apk add --update linux-headers
|
||||
RUN pecl install xdebug
|
||||
RUN docker-php-ext-enable xdebug
|
||||
RUN apk del -f .build-deps
|
||||
|
||||
COPY ./docker/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
xdebug.mode=debug
|
||||
xdebug.start_with_request=trigger
|
||||
xdebug.discover_client_host = 1
|
||||
xdebug.client_host=${XDEBUG_CLIENT_HOST}
|
||||
xdebug.client_port=${XDEBUG_CLIENT_PORT}
|
|
@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration;
|
|||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20240528093352 extends AbstractMigration
|
||||
final class Version20240617113606 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
|
@ -20,21 +20,28 @@ final class Version20240528093352 extends AbstractMigration
|
|||
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 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, 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, name VARCHAR(255) NOT 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 hardware (id INT AUTO_INCREMENT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_FE99E9E0D17F50A6 (uuid), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE hardware_profile (id INT AUTO_INCREMENT NOT NULL, organizational_unit_id INT DEFAULT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, comments VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_2D9A2460D17F50A6 (uuid), INDEX IDX_2D9A2460FB84408A (organizational_unit_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE hardware_profile_hardware (hardware_profile_id INT NOT NULL, hardware_id INT NOT NULL, INDEX IDX_18C7E12CFA495C1 (hardware_profile_id), INDEX IDX_18C7E12C9CC762B (hardware_id), PRIMARY KEY(hardware_profile_id, hardware_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE menu (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, title VARCHAR(255) NOT NULL, resolution VARCHAR(255) NOT NULL, comments VARCHAR(255) DEFAULT NULL, public_url VARCHAR(255) DEFAULT NULL, private_url VARCHAR(255) DEFAULT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_7D053A93D17F50A6 (uuid), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE network_settings (id INT AUTO_INCREMENT NOT NULL, menu_id INT DEFAULT NULL, hardware_profile_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, 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 DEFAULT NULL, mcast_mode VARCHAR(255) DEFAULT NULL, mcast_port INT DEFAULT NULL, validation TINYINT(1) DEFAULT NULL, UNIQUE INDEX UNIQ_48869B54D17F50A6 (uuid), INDEX IDX_48869B54CCD7E912 (menu_id), INDEX IDX_48869B54CFA495C1 (hardware_profile_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE organizational_unit (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, network_settings_id INT DEFAULT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, comments VARCHAR(255) DEFAULT NULL, path VARCHAR(255) DEFAULT NULL, level INT DEFAULT NULL, slug VARCHAR(255) DEFAULT NULL, type VARCHAR(255) NOT NULL, location VARCHAR(255) DEFAULT NULL, projector TINYINT(1) DEFAULT NULL, board TINYINT(1) DEFAULT NULL, capacity INT DEFAULT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_749AEB2DD17F50A6 (uuid), INDEX IDX_749AEB2D727ACA70 (parent_id), INDEX IDX_749AEB2D9B9A36D0 (network_settings_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE `partition` (id INT AUTO_INCREMENT NOT NULL, client_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, disk_number INT DEFAULT NULL, partition_number INT DEFAULT NULL, partition_code VARCHAR(255) DEFAULT NULL, size INT NOT NULL, cache_content VARCHAR(255) DEFAULT NULL, filesystem VARCHAR(255) DEFAULT NULL, os_name VARCHAR(255) NOT NULL, memory_usage INT NOT NULL, UNIQUE INDEX UNIQ_9EB910E4D17F50A6 (uuid), INDEX IDX_9EB910E419EB6921 (client_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 hardware_profile ADD CONSTRAINT FK_2D9A2460FB84408A FOREIGN KEY (organizational_unit_id) REFERENCES organizational_unit (id)');
|
||||
$this->addSql('ALTER TABLE hardware_profile_hardware ADD CONSTRAINT FK_18C7E12CFA495C1 FOREIGN KEY (hardware_profile_id) REFERENCES hardware_profile (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE hardware_profile_hardware ADD CONSTRAINT FK_18C7E12C9CC762B FOREIGN KEY (hardware_id) REFERENCES hardware (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE network_settings ADD CONSTRAINT FK_48869B54CCD7E912 FOREIGN KEY (menu_id) REFERENCES menu (id)');
|
||||
$this->addSql('ALTER TABLE network_settings ADD CONSTRAINT FK_48869B54CFA495C1 FOREIGN KEY (hardware_profile_id) REFERENCES hardware_profile (id)');
|
||||
$this->addSql('ALTER TABLE organizational_unit ADD CONSTRAINT FK_749AEB2D727ACA70 FOREIGN KEY (parent_id) REFERENCES organizational_unit (id) ON DELETE SET NULL');
|
||||
$this->addSql('ALTER TABLE organizational_unit ADD CONSTRAINT FK_749AEB2D9B9A36D0 FOREIGN KEY (network_settings_id) REFERENCES network_settings (id)');
|
||||
$this->addSql('ALTER TABLE `partition` ADD CONSTRAINT FK_9EB910E419EB6921 FOREIGN KEY (client_id) REFERENCES client (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');
|
||||
|
@ -45,19 +52,26 @@ final class Version20240528093352 extends AbstractMigration
|
|||
{
|
||||
// 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 hardware_profile DROP FOREIGN KEY FK_2D9A2460FB84408A');
|
||||
$this->addSql('ALTER TABLE hardware_profile_hardware DROP FOREIGN KEY FK_18C7E12CFA495C1');
|
||||
$this->addSql('ALTER TABLE hardware_profile_hardware DROP FOREIGN KEY FK_18C7E12C9CC762B');
|
||||
$this->addSql('ALTER TABLE network_settings DROP FOREIGN KEY FK_48869B54CCD7E912');
|
||||
$this->addSql('ALTER TABLE network_settings DROP FOREIGN KEY FK_48869B54CFA495C1');
|
||||
$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 `partition` DROP FOREIGN KEY FK_9EB910E419EB6921');
|
||||
$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 hardware');
|
||||
$this->addSql('DROP TABLE hardware_profile');
|
||||
$this->addSql('DROP TABLE hardware_profile_hardware');
|
||||
$this->addSql('DROP TABLE menu');
|
||||
$this->addSql('DROP TABLE network_settings');
|
||||
$this->addSql('DROP TABLE ordenadores');
|
||||
$this->addSql('DROP TABLE organizational_unit');
|
||||
$this->addSql('DROP TABLE `partition`');
|
||||
$this->addSql('DROP TABLE refresh_tokens');
|
||||
$this->addSql('DROP TABLE user');
|
||||
$this->addSql('DROP TABLE user_organizational_unit');
|
|
@ -0,0 +1,39 @@
|
|||
<?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 Version20240618062825 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 menu_id INT DEFAULT NULL, ADD hardware_profile_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C7440455CCD7E912 FOREIGN KEY (menu_id) REFERENCES menu (id)');
|
||||
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C7440455CFA495C1 FOREIGN KEY (hardware_profile_id) REFERENCES hardware_profile (id)');
|
||||
$this->addSql('CREATE INDEX IDX_C7440455CCD7E912 ON client (menu_id)');
|
||||
$this->addSql('CREATE INDEX IDX_C7440455CFA495C1 ON client (hardware_profile_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE client DROP FOREIGN KEY FK_C7440455CCD7E912');
|
||||
$this->addSql('ALTER TABLE client DROP FOREIGN KEY FK_C7440455CFA495C1');
|
||||
$this->addSql('DROP INDEX IDX_C7440455CCD7E912 ON client');
|
||||
$this->addSql('DROP INDEX IDX_C7440455CFA495C1 ON client');
|
||||
$this->addSql('ALTER TABLE client DROP menu_id, DROP hardware_profile_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?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 Version20240618083013 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE hardware_type (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, UNIQUE INDEX UNIQ_2AA5A113D17F50A6 (uuid), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE operative_system (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, UNIQUE INDEX UNIQ_E9C44095D17F50A6 (uuid), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE operative_system_type (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, UNIQUE INDEX UNIQ_4A13A156D17F50A6 (uuid), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE hardware ADD type_id INT DEFAULT NULL, DROP type');
|
||||
$this->addSql('ALTER TABLE hardware ADD CONSTRAINT FK_FE99E9E0C54C8C93 FOREIGN KEY (type_id) REFERENCES hardware_type (id)');
|
||||
$this->addSql('CREATE INDEX IDX_FE99E9E0C54C8C93 ON hardware (type_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE hardware DROP FOREIGN KEY FK_FE99E9E0C54C8C93');
|
||||
$this->addSql('DROP TABLE hardware_type');
|
||||
$this->addSql('DROP TABLE operative_system');
|
||||
$this->addSql('DROP TABLE operative_system_type');
|
||||
$this->addSql('DROP INDEX IDX_FE99E9E0C54C8C93 ON hardware');
|
||||
$this->addSql('ALTER TABLE hardware ADD type VARCHAR(255) DEFAULT NULL, DROP type_id');
|
||||
}
|
||||
}
|
|
@ -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 Version20240618113629 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 UNIQUE INDEX UNIQ_IDENTIFIER_NAME ON organizational_unit (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 organizational_unit');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20240619083230 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 UNIQUE INDEX UNIQ_IDENTIFIER_IP ON client (ip)');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_MAC ON client (mac)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP INDEX UNIQ_IDENTIFIER_IP ON client');
|
||||
$this->addSql('DROP INDEX UNIQ_IDENTIFIER_MAC ON client');
|
||||
}
|
||||
}
|
|
@ -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 Version20240619084701 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 validation TINYINT(1) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE client DROP validation');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20240619104206 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 `partition` ADD operative_system_id INT DEFAULT NULL, DROP os_name');
|
||||
$this->addSql('ALTER TABLE `partition` ADD CONSTRAINT FK_9EB910E4F1E9F66E FOREIGN KEY (operative_system_id) REFERENCES operative_system (id)');
|
||||
$this->addSql('CREATE INDEX IDX_9EB910E4F1E9F66E ON `partition` (operative_system_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE `partition` DROP FOREIGN KEY FK_9EB910E4F1E9F66E');
|
||||
$this->addSql('DROP INDEX IDX_9EB910E4F1E9F66E ON `partition`');
|
||||
$this->addSql('ALTER TABLE `partition` ADD os_name VARCHAR(255) NOT NULL, DROP operative_system_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20240620095914 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 `partition` DROP FOREIGN KEY FK_9EB910E419EB6921');
|
||||
$this->addSql('ALTER TABLE `partition` ADD CONSTRAINT FK_9EB910E419EB6921 FOREIGN KEY (client_id) REFERENCES client (id) ON DELETE SET NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE `partition` DROP FOREIGN KEY FK_9EB910E419EB6921');
|
||||
$this->addSql('ALTER TABLE `partition` ADD CONSTRAINT FK_9EB910E419EB6921 FOREIGN KEY (client_id) REFERENCES client (id)');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20240620100039 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 `partition` DROP FOREIGN KEY FK_9EB910E419EB6921');
|
||||
$this->addSql('ALTER TABLE `partition` ADD CONSTRAINT FK_9EB910E419EB6921 FOREIGN KEY (client_id) REFERENCES client (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 `partition` DROP FOREIGN KEY FK_9EB910E419EB6921');
|
||||
$this->addSql('ALTER TABLE `partition` ADD CONSTRAINT FK_9EB910E419EB6921 FOREIGN KEY (client_id) REFERENCES client (id) ON DELETE SET NULL');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20240621085144 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('DROP INDEX UNIQ_IDENTIFIER_NAME ON organizational_unit');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_NAME ON organizational_unit (name, parent_id)');
|
||||
}
|
||||
|
||||
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 organizational_unit');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_NAME ON organizational_unit (name)');
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration;
|
|||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20240529131520 extends AbstractMigration
|
||||
final class Version20240701123613 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
|
@ -20,15 +20,14 @@ final class Version20240529131520 extends AbstractMigration
|
|||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
|
||||
$this->addSql('ALTER TABLE organizational_unit DROP FOREIGN KEY FK_749AEB2D727ACA70');
|
||||
$this->addSql('ALTER TABLE organizational_unit ADD CONSTRAINT FK_749AEB2D727ACA70 FOREIGN KEY (parent_id) REFERENCES organizational_unit (id) ON DELETE SET NULL');
|
||||
$this->addSql('ALTER TABLE client DROP FOREIGN KEY FK_C7440455FB84408A');
|
||||
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C7440455FB84408A 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 organizational_unit DROP FOREIGN KEY FK_749AEB2D727ACA70');
|
||||
$this->addSql('ALTER TABLE organizational_unit ADD CONSTRAINT FK_749AEB2D727ACA70 FOREIGN KEY (parent_id) REFERENCES organizational_unit (id)');
|
||||
$this->addSql('ALTER TABLE client DROP FOREIGN KEY FK_C7440455FB84408A');
|
||||
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C7440455FB84408A FOREIGN KEY (organizational_unit_id) REFERENCES organizational_unit (id)');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?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 Version20240702132742 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 software (id INT AUTO_INCREMENT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_77D068CFD17F50A6 (uuid), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE software_profile (id INT AUTO_INCREMENT NOT NULL, organizational_unit_id INT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, comments VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_B70C3C9BD17F50A6 (uuid), INDEX IDX_B70C3C9BFB84408A (organizational_unit_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE software_profile_software (software_profile_id INT NOT NULL, software_id INT NOT NULL, INDEX IDX_3DDFEC7ED42A742 (software_profile_id), INDEX IDX_3DDFEC7D7452741 (software_id), PRIMARY KEY(software_profile_id, software_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE software_profile ADD CONSTRAINT FK_B70C3C9BFB84408A FOREIGN KEY (organizational_unit_id) REFERENCES organizational_unit (id)');
|
||||
$this->addSql('ALTER TABLE software_profile_software ADD CONSTRAINT FK_3DDFEC7ED42A742 FOREIGN KEY (software_profile_id) REFERENCES software_profile (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE software_profile_software ADD CONSTRAINT FK_3DDFEC7D7452741 FOREIGN KEY (software_id) REFERENCES software (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 software_profile DROP FOREIGN KEY FK_B70C3C9BFB84408A');
|
||||
$this->addSql('ALTER TABLE software_profile_software DROP FOREIGN KEY FK_3DDFEC7ED42A742');
|
||||
$this->addSql('ALTER TABLE software_profile_software DROP FOREIGN KEY FK_3DDFEC7D7452741');
|
||||
$this->addSql('DROP TABLE software');
|
||||
$this->addSql('DROP TABLE software_profile');
|
||||
$this->addSql('DROP TABLE software_profile_software');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20240703090301 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 image (id INT AUTO_INCREMENT NOT NULL, client_id INT NOT NULL, software_profile_id INT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, comments VARCHAR(255) DEFAULT NULL, path VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, revision VARCHAR(255) DEFAULT NULL, info VARCHAR(255) DEFAULT NULL, size INT NOT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_C53D045FD17F50A6 (uuid), INDEX IDX_C53D045F19EB6921 (client_id), INDEX IDX_C53D045FED42A742 (software_profile_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE image ADD CONSTRAINT FK_C53D045F19EB6921 FOREIGN KEY (client_id) REFERENCES client (id)');
|
||||
$this->addSql('ALTER TABLE image ADD CONSTRAINT FK_C53D045FED42A742 FOREIGN KEY (software_profile_id) REFERENCES software_profile (id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image DROP FOREIGN KEY FK_C53D045F19EB6921');
|
||||
$this->addSql('ALTER TABLE image DROP FOREIGN KEY FK_C53D045FED42A742');
|
||||
$this->addSql('DROP TABLE image');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
<?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 Version20240715084147 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_user_group (user_id INT NOT NULL, user_group_id INT NOT NULL, INDEX IDX_28657971A76ED395 (user_id), INDEX IDX_286579711ED93D47 (user_group_id), PRIMARY KEY(user_id, user_group_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE user_user_group ADD CONSTRAINT FK_28657971A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE user_user_group ADD CONSTRAINT FK_286579711ED93D47 FOREIGN KEY (user_group_id) REFERENCES user_group (id) ON DELETE CASCADE');
|
||||
$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_user');
|
||||
$this->addSql('ALTER TABLE hardware_profile CHANGE organizational_unit_id organizational_unit_id INT NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE user_group_user (user_group_id INT NOT NULL, user_id INT NOT NULL, INDEX IDX_3AE4BD5A76ED395 (user_id), INDEX IDX_3AE4BD51ED93D47 (user_group_id), PRIMARY KEY(user_group_id, user_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
|
||||
$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');
|
||||
$this->addSql('ALTER TABLE user_user_group DROP FOREIGN KEY FK_28657971A76ED395');
|
||||
$this->addSql('ALTER TABLE user_user_group DROP FOREIGN KEY FK_286579711ED93D47');
|
||||
$this->addSql('DROP TABLE user_user_group');
|
||||
$this->addSql('ALTER TABLE hardware_profile CHANGE organizational_unit_id organizational_unit_id INT DEFAULT NULL');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
namespace App\Command\Migration;
|
||||
|
||||
use App\Entity\Client;
|
||||
use App\Entity\HardwareProfile;
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query\ResultSetMapping;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
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:clients', description: 'Migrate clients data')]
|
||||
class MigrateClientsCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly ManagerRegistry $doctrine
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
/** @var EntityManagerInterface $oldDatabaseEntityManager */
|
||||
$oldDatabaseEntityManager = $this->doctrine->getManager('og_1');
|
||||
|
||||
$clientRepository = $this->entityManager->getRepository(Client::class);
|
||||
$organizationalUnitRepository = $this->entityManager->getRepository(OrganizationalUnit::class);
|
||||
$hardwareProfileRepository = $this->entityManager->getRepository(HardwareProfile::class);
|
||||
|
||||
/** Obtener los ordenadores de la base de datos antigua **/
|
||||
$rsmClients = new ResultSetMapping();
|
||||
$rsmClients->addScalarResult('idordenador', 'idordenador');
|
||||
$rsmClients->addScalarResult('nombreordenador', 'nombreordenador');
|
||||
$rsmClients->addScalarResult('numserie', 'numserie');
|
||||
$rsmClients->addScalarResult('mac', 'mac');
|
||||
$rsmClients->addScalarResult('ip', 'ip');
|
||||
$rsmClients->addScalarResult('netiface', 'netiface');
|
||||
$rsmClients->addScalarResult('netdriver', 'netdriver');
|
||||
$rsmClients->addScalarResult('idperfilhard', 'ordenadores.idperfilhard');
|
||||
$rsmClients->addScalarResult('grupoid', 'ordenadores.grupoid');
|
||||
$rsmClients->addScalarResult('idaula', 'ordenadores.idaula');
|
||||
|
||||
$clientsQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idordenador, nombreordenador, numserie, ip, mac, netiface, netdriver, ordenadores.idaula, ordenadores.grupoid, ordenadores.idperfilhard FROM ordenadores LEFT JOIN aulas ON ordenadores.idaula = aulas.idaula LEFT JOIN perfileshard ON ordenadores.idperfilhard = perfileshard.idperfilhard', $rsmClients);
|
||||
$clients = $clientsQuery->getResult();
|
||||
|
||||
/** Ordenadores **/
|
||||
$output->writeln("CLIENTES TOTAL: ". count($clients));
|
||||
foreach ($clients as $client){
|
||||
$clientEntity = $clientRepository->findOneBy(['migrationId' => $client['idordenador']]);
|
||||
if(!$clientEntity){
|
||||
$clientEntity = new Client();
|
||||
$clientEntity->setMigrationId($client['idordenador']);
|
||||
$clientEntity->setName($client['nombreordenador']);
|
||||
$clientEntity->setSerialNumber($client['numserie']);
|
||||
$clientEntity->setNetiface($client['netiface']);
|
||||
$clientEntity->setNetdriver($client['netdriver']);
|
||||
$clientEntity->setMac($client['mac']);
|
||||
$clientEntity->setIp($client['ip']);
|
||||
}
|
||||
|
||||
$migrationId = $client['ordenadores.grupoid'] === 0 ? $client['ordenadores.idaula'] : $client['ordenadores.grupoid'];
|
||||
$organizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $migrationId]);
|
||||
|
||||
if ($organizationalUnit){
|
||||
$clientEntity->setOrganizationalUnit($organizationalUnit);
|
||||
}
|
||||
|
||||
$hardwareProfile = $hardwareProfileRepository->findOneBy(['migrationId' => $client['ordenadores.idperfilhard']]);
|
||||
if ($hardwareProfile){
|
||||
$clientEntity->setHardwareProfile($hardwareProfile);
|
||||
}
|
||||
|
||||
$this->entityManager->persist($clientEntity);
|
||||
}
|
||||
$this->entityManager->flush();
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
<?php
|
||||
|
||||
namespace App\Command\Migration;
|
||||
|
||||
use App\Entity\Hardware;
|
||||
use App\Entity\HardwareProfile;
|
||||
use App\Entity\HardwareType;
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query\ResultSetMapping;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
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:migrate-hardware-profile', description: 'Migrate hardware and hardware profile data')]
|
||||
class MigrateHardwareAndHardwareProfileCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly ManagerRegistry $doctrine
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
/** @var EntityManagerInterface $oldDatabaseEntityManager */
|
||||
$oldDatabaseEntityManager = $this->doctrine->getManager('og_1');
|
||||
|
||||
$organizationalUnitRepository = $this->entityManager->getRepository(OrganizationalUnit::class);
|
||||
$hardwareProfileRepository = $this->entityManager->getRepository(HardwareProfile::class);
|
||||
$hardwareTypeRepository = $this->entityManager->getRepository(HardwareType::class);
|
||||
$hardwareRepository = $this->entityManager->getRepository(Hardware::class);
|
||||
|
||||
/** Obtener los perfiles hardware de la base de datos antigua **/
|
||||
$rsmHardwareTypes = new ResultSetMapping();
|
||||
$rsmHardwareTypes->addScalarResult('idtipohardware', 'idtipohardware');
|
||||
$rsmHardwareTypes->addScalarResult('descripcion', 'descripcion');
|
||||
|
||||
$hardwareTypesQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idtipohardware, descripcion FROM tipohardwares', $rsmHardwareTypes);
|
||||
$hardwareTypes = $hardwareTypesQuery->getResult();
|
||||
|
||||
$output->writeln("TIPOS HARDWARE TOTAL: ". count($hardwareTypes));
|
||||
foreach ($hardwareTypes as $hardwareType){
|
||||
$hardwareProfileEntity = null;
|
||||
$hardwareProfileEntity = $hardwareTypeRepository->findOneBy(['migrationId' => $hardwareType['idtipohardware']]);
|
||||
if(!$hardwareProfileEntity){
|
||||
$hardwareProfileEntity = new HardwareType();
|
||||
$hardwareProfileEntity->setMigrationId($hardwareType['idtipohardware']);
|
||||
$hardwareProfileEntity->setName($hardwareType['descripcion']);
|
||||
}
|
||||
|
||||
$this->entityManager->persist($hardwareProfileEntity);
|
||||
}
|
||||
|
||||
/** Obtener los hardware de la base de datos antigua **/
|
||||
$rsmHardware = new ResultSetMapping();
|
||||
$rsmHardware->addScalarResult('idhardware', 'idhardware');
|
||||
$rsmHardware->addScalarResult('idtipohardware', 'hardwares.idtipohardware');
|
||||
$rsmHardware->addScalarResult('descripcion', 'descripcion');
|
||||
$rsmHardware->addScalarResult('grupoid', 'hardwares.grupoid');
|
||||
$rsmHardware->addScalarResult('idcentro', 'hardwares.idcentro');
|
||||
|
||||
$hardwareQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idhardware, hardwares.idtipohardware, hardwares.descripcion, hardwares.grupoid, hardwares.idcentro FROM hardwares LEFT JOIN tipohardwares ON hardwares.idtipohardware = tipohardwares.idtipohardware', $rsmHardware);
|
||||
$hardwareCollection = $hardwareQuery->getResult();
|
||||
|
||||
$output->writeln("HARDWARE TOTAL: ". count($hardwareCollection));
|
||||
foreach ($hardwareCollection as $hardware){
|
||||
$hardwareEntity = null;
|
||||
$hardwareEntity = $hardwareRepository->findOneBy(['migrationId' => $hardware['idhardware']]);
|
||||
if(!$hardwareEntity){
|
||||
$hardwareEntity = new Hardware();
|
||||
$hardwareEntity->setMigrationId($hardware['idhardware']);
|
||||
$hardwareEntity->setDescription($hardware['descripcion']);
|
||||
$hardwareEntity->setName($hardware['descripcion']);
|
||||
}
|
||||
|
||||
$hardwareType = $hardwareTypeRepository->findOneBy(['migrationId' => $hardware['hardwares.idtipohardware']]);
|
||||
if ($hardwareType){
|
||||
$hardwareEntity->setType($hardwareType);
|
||||
}
|
||||
|
||||
$migrationId = $hardware['hardwares.grupoid'] === 0 ? $hardware['hardwares.idcentro'] : $hardware['hardwares.grupoid'];
|
||||
$organizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $migrationId]);
|
||||
|
||||
/*
|
||||
if ($organizationalUnit){
|
||||
$hardwareEntity->setOrganizationalUnit($organizationalUnit);
|
||||
}*/
|
||||
|
||||
$this->entityManager->persist($hardwareEntity);
|
||||
}
|
||||
|
||||
/** Obtener los perfiles hardware de la base de datos antigua **/
|
||||
$rsmHardwareProfiles = new ResultSetMapping();
|
||||
$rsmHardwareProfiles->addScalarResult('idperfilhard', 'idperfilhard');
|
||||
$rsmHardwareProfiles->addScalarResult('descripcion', 'descripcion');
|
||||
$rsmHardwareProfiles->addScalarResult('comentarios', 'perfilhard.comentarios');
|
||||
$rsmHardwareProfiles->addScalarResult('grupoid', 'perfilhard.grupoid');
|
||||
$rsmHardwareProfiles->addScalarResult('idcentro', 'perfilhard.idcentro');
|
||||
|
||||
$hardwareProfilesQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idperfilhard, descripcion, grupos.comentarios, perfileshard.grupoid, perfileshard.idcentro FROM perfileshard LEFT JOIN grupos ON perfileshard.grupoid = grupos.idgrupo', $rsmHardwareProfiles);
|
||||
$hardwareProfiles = $hardwareProfilesQuery->getResult();
|
||||
|
||||
/** Perfiles hardware **/
|
||||
$output->writeln("PERFILES HARDWARE TOTAL: ". count($hardwareProfiles));
|
||||
foreach ($hardwareProfiles as $hardwareProfile){
|
||||
$hardwareProfileEntity = null;
|
||||
$hardwareProfileEntity = $hardwareProfileRepository->findOneBy(['migrationId' => $hardwareProfile['idperfilhard']]);
|
||||
if(!$hardwareProfileEntity){
|
||||
$hardwareProfileEntity = new HardwareProfile();
|
||||
$hardwareProfileEntity->setMigrationId($hardwareProfile['idperfilhard']);
|
||||
$hardwareProfileEntity->setDescription($hardwareProfile['descripcion']);
|
||||
$hardwareProfileEntity->setComments($hardwareProfile['perfilhard.comentarios']);
|
||||
}
|
||||
|
||||
$migrationId = $hardwareProfile['perfilhard.grupoid'] === 0 ? $hardwareProfile['perfilhard.idcentro'] : $hardwareProfile['perfilhard.grupoid'];
|
||||
$organizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $migrationId]);
|
||||
|
||||
if ($organizationalUnit){
|
||||
$hardwareProfileEntity->setOrganizationalUnit($organizationalUnit);
|
||||
}
|
||||
|
||||
$this->entityManager->persist($hardwareProfileEntity);
|
||||
}
|
||||
|
||||
/** Obtener los hardware, y asignarselos a los perfiles hardware **/
|
||||
$rsmHardwareProfilesRelation = new ResultSetMapping();
|
||||
$rsmHardwareProfilesRelation->addScalarResult('idperfilhard', 'idperfilhard');
|
||||
$rsmHardwareProfilesRelation->addScalarResult('idhardware', 'idhardware');
|
||||
|
||||
$hardwareProfilesQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idperfilhard, idhardware FROM perfileshard_hardwares', $rsmHardwareProfilesRelation);
|
||||
$hardwareProfileRelations = $hardwareProfilesQuery->getResult();
|
||||
|
||||
$output->writeln("PERFILES HARDWARE RELACIONES TOTAL: ". count($hardwareProfileRelations));
|
||||
foreach ($hardwareProfileRelations as $hardwareProfileRelation){
|
||||
$hardwareProfileEntity = $hardwareProfileRepository->findOneBy(['migrationId' => $hardwareProfileRelation['idperfilhard']]);
|
||||
$hardwareEntity = $hardwareRepository->findOneBy(['migrationId' => $hardwareProfileRelation['idhardware']]);
|
||||
|
||||
if ($hardwareProfileEntity && $hardwareEntity){
|
||||
$hardwareProfileEntity->addHardwareCollection($hardwareEntity);
|
||||
$this->entityManager->persist($hardwareProfileEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace App\Command\Migration;
|
||||
|
||||
use App\Entity\Client;
|
||||
use App\Entity\HardwareProfile;
|
||||
use App\Entity\OperativeSystem;
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query\ResultSetMapping;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
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:os', description: 'Migrate os data')]
|
||||
class MigrateOperativeSystemCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly ManagerRegistry $doctrine
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
/** @var EntityManagerInterface $oldDatabaseEntityManager */
|
||||
$oldDatabaseEntityManager = $this->doctrine->getManager('og_1');
|
||||
|
||||
$osRepository = $this->entityManager->getRepository(OperativeSystem::class);
|
||||
|
||||
/** Obtener los sistemas operativos de la base de datos antigua **/
|
||||
$rsmOperativeSystems = new ResultSetMapping();
|
||||
$rsmOperativeSystems->addScalarResult('idnombreso', 'idnombreso');
|
||||
$rsmOperativeSystems->addScalarResult('nombreso', 'nombreso');
|
||||
|
||||
$operativeSystemQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idnombreso, nombreso FROM nombresos', $rsmOperativeSystems);
|
||||
$opeativeSystems = $operativeSystemQuery->getResult();
|
||||
|
||||
/** Sistemas operativos **/
|
||||
$output->writeln("SISTEMAS OPERATIVOS TOTAL: ". count($opeativeSystems));
|
||||
foreach ($opeativeSystems as $client){
|
||||
$osEntity = $osRepository->findOneBy(['migrationId' => $client['idnombreso']]);
|
||||
if(!$osEntity) {
|
||||
$osEntity = new OperativeSystem();
|
||||
$osEntity->setMigrationId($client['idnombreso']);
|
||||
$osEntity->setName($client['nombreso']);
|
||||
}
|
||||
|
||||
$this->entityManager->persist($osEntity);
|
||||
}
|
||||
$this->entityManager->flush();
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
|
@ -2,14 +2,12 @@
|
|||
|
||||
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 App\Model\OrganizationalUnitTypes;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query\ResultSetMapping;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
@ -20,7 +18,7 @@ class MigrateOrganizationalUnitCommand extends Command
|
|||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly EntityManagerInterface $entityManagerSlave
|
||||
private readonly ManagerRegistry $doctrine
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
|
@ -28,40 +26,124 @@ class MigrateOrganizationalUnitCommand extends Command
|
|||
|
||||
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();
|
||||
/** @var EntityManagerInterface $oldDatabaseEntityManager */
|
||||
$oldDatabaseEntityManager = $this->doctrine->getManager('og_1');
|
||||
|
||||
/** Obtener los centros de la base de datos antigua **/
|
||||
$rsmCenters = new ResultSetMapping();
|
||||
$rsmCenters->addScalarResult('idcentro', 'idcentro');
|
||||
$rsmCenters->addScalarResult('nombrecentro', 'nombrecentro');
|
||||
$rsmCenters->addScalarResult('comentarios', 'comentarios');
|
||||
|
||||
$centersQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idcentro, nombrecentro, comentarios FROM centros', $rsmCenters);
|
||||
$centers = $centersQuery->getResult();
|
||||
|
||||
/** Obtener los grupos de aulas de la base de datos antigua **/
|
||||
$rsmGroups = new ResultSetMapping();
|
||||
$rsmGroups->addScalarResult('idgrupo', 'idgrupo');
|
||||
$rsmGroups->addScalarResult('nombregrupo', 'nombregrupo');
|
||||
$rsmGroups->addScalarResult('comentarios', 'grupos.comentarios');
|
||||
$rsmGroups->addScalarResult('idcentro', 'grupos.idcentro');
|
||||
|
||||
$groupsQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idgrupo, nombregrupo, grupos.comentarios, grupos.idcentro FROM grupos LEFT JOIN centros ON grupos.idcentro = centros.idcentro', $rsmGroups);
|
||||
$groups = $groupsQuery->getResult();
|
||||
|
||||
/** Obtener las aulas de la base de datos antigua **/
|
||||
$rsmClassrooms = new ResultSetMapping();
|
||||
$rsmClassrooms->addScalarResult('idaula', 'idaula');
|
||||
$rsmClassrooms->addScalarResult('nombreaula', 'nombreaula');
|
||||
$rsmClassrooms->addScalarResult('comentarios', 'aulas.comentarios');
|
||||
$rsmClassrooms->addScalarResult('grupoid', 'aulas.grupoid');
|
||||
$rsmClassrooms->addScalarResult('idcentro', 'aulas.idcentro');
|
||||
$rsmClassrooms->addScalarResult('proxy', 'proxy');
|
||||
$rsmClassrooms->addScalarResult('dns', 'dns');
|
||||
$rsmClassrooms->addScalarResult('netmask', 'netmask');
|
||||
$rsmClassrooms->addScalarResult('router', 'router');
|
||||
$rsmClassrooms->addScalarResult('ntp', 'ntp');
|
||||
$rsmClassrooms->addScalarResult('timep2p', 'timep2p');
|
||||
$rsmClassrooms->addScalarResult('modp2p', 'modp2p');
|
||||
$rsmClassrooms->addScalarResult('ipmul', 'ipmul');
|
||||
$rsmClassrooms->addScalarResult('pormul', 'pormul');
|
||||
$rsmClassrooms->addScalarResult('modomul', 'modomul');
|
||||
$rsmClassrooms->addScalarResult('velmul', 'velmul');
|
||||
$rsmClassrooms->addScalarResult('pizarra', 'pizarra');
|
||||
$rsmClassrooms->addScalarResult('cagnon', 'cagnon');
|
||||
$rsmClassrooms->addScalarResult('ubicacion', 'ubicacion');
|
||||
|
||||
$roomsQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idaula, nombreaula, aulas.comentarios, aulas.grupoid, aulas.idcentro, proxy, dns, netmask, router, ntp, timep2p, modp2p, modomul, ipmul, velmul, pormul, pizarra, cagnon, ubicacion FROM aulas LEFT JOIN grupos ON aulas.grupoid = grupos.idgrupo', $rsmClassrooms);
|
||||
$rooms = $roomsQuery->getResult();
|
||||
|
||||
/** Obtener los grupos de ordenadores de la base de datos antigua **/
|
||||
$rsmClientGroups = new ResultSetMapping();
|
||||
$rsmClientGroups->addScalarResult('idgrupo', 'idgrupo');
|
||||
$rsmClientGroups->addScalarResult('nombregrupoordenador', 'nombregrupoordenador');
|
||||
$rsmClientGroups->addScalarResult('comentarios', 'gruposordenadores.comentarios');
|
||||
$rsmClientGroups->addScalarResult('idaula', 'gruposordenadores.idaula');
|
||||
$clientGroupsQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idgrupo, nombregrupoordenador, gruposordenadores.comentarios, gruposordenadores.idaula FROM gruposordenadores LEFT JOIN aulas ON gruposordenadores.idaula = aulas.idaula', $rsmClientGroups);
|
||||
$clientGroups = $clientGroupsQuery->getResult();
|
||||
|
||||
$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()]);
|
||||
$centerOrganizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $center['idcentro'], 'type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT]);
|
||||
if(!$centerOrganizationalUnit){
|
||||
$centerOrganizationalUnit = new OrganizationalUnit();
|
||||
$centerOrganizationalUnit->setMigrationId($center->getIdcentro());
|
||||
$centerOrganizationalUnit->setName($center->getNombrecentro());
|
||||
$centerOrganizationalUnit->setComments($center->getComentarios());
|
||||
$centerOrganizationalUnit->setMigrationId($center['idcentro']);
|
||||
$centerOrganizationalUnit->setName($center['nombrecentro']);
|
||||
$centerOrganizationalUnit->setComments($center['comentarios']);
|
||||
$centerOrganizationalUnit->setType(OrganizationalUnitTypes::ORGANIZATIONAL_UNIT);
|
||||
$this->entityManager->persist($centerOrganizationalUnit);
|
||||
}
|
||||
}
|
||||
$this->entityManager->flush();
|
||||
|
||||
/** Grupos de aulas **/
|
||||
$output->writeln("GRUPOS DE AULAS TOTAL: ". count($groups));
|
||||
foreach ($groups as $group){
|
||||
$groupPcOrganizationalUnit = null;
|
||||
$groupPcOrganizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $group['idgrupo'], 'type' => OrganizationalUnitTypes::CLASSROOMS_GROUP]);
|
||||
if(!$groupPcOrganizationalUnit){
|
||||
$groupPcOrganizationalUnit = new OrganizationalUnit();
|
||||
$groupPcOrganizationalUnit->setMigrationId($group['idgrupo']);
|
||||
$groupPcOrganizationalUnit->setName($group['nombregrupo']);
|
||||
$groupPcOrganizationalUnit->setComments($group['grupos.comentarios']);
|
||||
$groupPcOrganizationalUnit->setType(OrganizationalUnitTypes::CLASSROOMS_GROUP);
|
||||
|
||||
$center = $organizationalUnitRepository->findOneBy(['migrationId' => $group['grupos.idcentro']]);
|
||||
if ($center){
|
||||
$groupPcOrganizationalUnit->setParent($center);
|
||||
}
|
||||
|
||||
$this->entityManager->persist($groupPcOrganizationalUnit);
|
||||
}
|
||||
}
|
||||
$this->entityManager->flush();
|
||||
|
||||
/** Aulas **/
|
||||
$output->writeln("AULAS TOTAL: ". count($rooms));
|
||||
foreach ($rooms as $room){
|
||||
$roomOrganizationalUnit = null;
|
||||
$roomOrganizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $room->getIdaula()]);
|
||||
$roomOrganizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $room['idaula'], 'type' => OrganizationalUnitTypes::CLASSROOM]);
|
||||
if(!$roomOrganizationalUnit){
|
||||
$roomOrganizationalUnit = new OrganizationalUnit();
|
||||
$roomOrganizationalUnit->setMigrationId($room->getIdaula());
|
||||
$roomOrganizationalUnit->setName($room->getNombreaula());
|
||||
$roomOrganizationalUnitParent = $organizationalUnitRepository->findOneBy(['migrationId' => $room->getIdcentro()]);
|
||||
$roomOrganizationalUnit->setParent($roomOrganizationalUnitParent);
|
||||
$roomOrganizationalUnit->setMigrationId($room['idaula']);
|
||||
$roomOrganizationalUnit->setName($room['nombreaula']);
|
||||
$roomOrganizationalUnit->setComments($room['aulas.comentarios']);
|
||||
$roomOrganizationalUnit->setBoard($room['pizarra']);
|
||||
$roomOrganizationalUnit->setProjector($room['cagnon']);
|
||||
$roomOrganizationalUnit->setLocation($room['ubicacion']);
|
||||
$roomOrganizationalUnit->setType(OrganizationalUnitTypes::CLASSROOM);
|
||||
|
||||
$migrationId = $room['aulas.grupoid'] === 0 ? $room['aulas.idcentro'] : $room['aulas.grupoid'];
|
||||
$organizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $migrationId]);
|
||||
|
||||
if ($organizationalUnit){
|
||||
$roomOrganizationalUnit->setParent($organizationalUnit);
|
||||
}
|
||||
|
||||
$this->entityManager->persist($roomOrganizationalUnit);
|
||||
}
|
||||
|
||||
|
@ -71,82 +153,43 @@ class MigrateOrganizationalUnitCommand extends Command
|
|||
$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());
|
||||
$networkSettings->setProxy($room['proxy']);
|
||||
$networkSettings->setDns($room['dns']);
|
||||
$networkSettings->setNetmask($room['netmask']);
|
||||
$networkSettings->setRouter($room['router']);
|
||||
$networkSettings->setNtp($room['ntp']);
|
||||
$networkSettings->setP2pTime($room['timep2p']);
|
||||
$networkSettings->setP2pMode($room['modp2p']);
|
||||
$networkSettings->setMcastIp($room['ipmul']);
|
||||
$networkSettings->setMcastSpeed($room['velmul']);
|
||||
$networkSettings->setMcastPort($room['pormul']);
|
||||
$networkSettings->setMcastMode($room['modomul']);
|
||||
}
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
/** Grupo Ordenador **/
|
||||
$output->writeln("GRUPOS ORDENADORES ". count($rooms));
|
||||
foreach ($pcGroups as $group){
|
||||
$output->writeln("GRUPOS ORDENADORES ". count($clientGroups));
|
||||
foreach ($clientGroups as $clientGroup){
|
||||
$groupPcOrganizationalUnit = null;
|
||||
$migrateParentId = ($group->getGrupoid() == 0) ? $group->getIdaula() : $group->getGrupoid();
|
||||
$groupPcOrganizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $group->getIdgrupo()]);
|
||||
$groupPcOrganizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $clientGroup['idgrupo'], 'type' => OrganizationalUnitTypes::CLIENTS_GROUP]);
|
||||
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);
|
||||
$groupPcOrganizationalUnit->setMigrationId($clientGroup['idgrupo']);
|
||||
$groupPcOrganizationalUnit->setName($clientGroup['nombregrupoordenador']);
|
||||
$groupPcOrganizationalUnit->setComments($clientGroup['gruposordenadores.comentarios']);
|
||||
$groupPcOrganizationalUnit->setType(OrganizationalUnitTypes::CLIENTS_GROUP);
|
||||
|
||||
$room = $organizationalUnitRepository->findOneBy(['migrationId' => $clientGroup['gruposordenadores.idaula']]);
|
||||
if ($room){
|
||||
$groupPcOrganizationalUnit->setParent($room);
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
namespace App\Command\Migration;
|
||||
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use App\Entity\Software;
|
||||
use App\Entity\SoftwareProfile;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query\ResultSetMapping;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
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:migrate-software-profile', description: 'Migrate software and software profile data')]
|
||||
class MigrateSoftwareAndSoftwareProfileCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly ManagerRegistry $doctrine
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): void
|
||||
{
|
||||
/** @var EntityManagerInterface $oldDatabaseEntityManager */
|
||||
$oldDatabaseEntityManager = $this->doctrine->getManager('og_1');
|
||||
|
||||
$organizationalUnitRepository = $this->entityManager->getRepository(OrganizationalUnit::class);
|
||||
$softwareProfileRepository = $this->entityManager->getRepository(SoftwareProfile::class);
|
||||
$softwareRepository = $this->entityManager->getRepository(Software::class);
|
||||
|
||||
/** Obtener los perfiles software de la base de datos antigua **/
|
||||
$rsmSoftware = new ResultSetMapping();
|
||||
$rsmSoftware->addScalarResult('idtiposoftware', 'idtiposoftware');
|
||||
$rsmSoftware->addScalarResult('descripcion', 'descripcion');
|
||||
|
||||
$softwareQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idtiposoftware, descripcion FROM softwares', $rsmSoftware);
|
||||
$softwareCollection = $softwareQuery->getResult();
|
||||
|
||||
foreach ($softwareCollection as $software) {
|
||||
$softwareEntity = null;
|
||||
$softwareEntity = $softwareRepository->findOneBy(['migrationId' => $software['idtiposoftware']]);
|
||||
if (!$softwareEntity) {
|
||||
$softwareEntity = new Software();
|
||||
$softwareEntity->setMigrationId($software['idtiposoftware']);
|
||||
$softwareEntity->setName($software['descripcion']);
|
||||
$softwareEntity->setDescription($software['descripcion']);
|
||||
}
|
||||
|
||||
$this->entityManager->persist($softwareEntity);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Dto\Input\ChangeOrganizationalUnitInput;
|
||||
use App\Entity\Client;
|
||||
use App\Repository\ClientRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class ChangeOrganizationalUnitAction extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ClientRepository $clientRepository,
|
||||
private readonly EntityManagerInterface $entityManager
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
public function __invoke(ChangeOrganizationalUnitInput $input): JsonResponse
|
||||
{
|
||||
foreach ($input->clients as $client) {
|
||||
/** @var Client $client */
|
||||
$clientEntity = $this->clientRepository->find($client->getEntity()->getId());
|
||||
if (!$clientEntity) {
|
||||
throw new NotFoundHttpException('Client not found');
|
||||
}
|
||||
|
||||
$organizationalUnit = $input->organizationalUnit->getEntity();
|
||||
$clientEntity->setOrganizationalUnit($organizationalUnit);
|
||||
|
||||
$this->entityManager->persist($clientEntity);
|
||||
}
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
return new JsonResponse( data: 'Clients updated successfully', status: Response::HTTP_OK);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Dto\Input\OrganizationalUnitInput;
|
||||
use App\Dto\Output\OrganizationalUnitOutput;
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use App\Handler\OrganizationalUnitChangeParentHandler;
|
||||
use App\Repository\OrganizationalUnitRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class OrganizationalUnitChangeParentAction extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly OrganizationalUnitChangeParentHandler $organizationalUnitChangeParentHandler
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function __invoke(OrganizationalUnit $organizationalUnit): JsonResponse
|
||||
{
|
||||
$this->organizationalUnitChangeParentHandler->handle($organizationalUnit);
|
||||
|
||||
return new JsonResponse(data: 'Organizational unit parent changed successfully', status: Response::HTTP_OK);
|
||||
}
|
||||
}
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
namespace App\DataFixtures;
|
||||
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use App\Factory\OrganizationalUnitFactory;
|
||||
use App\Factory\UserFactory;
|
||||
use App\Model\UserGroupPermissions;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
|
@ -11,7 +9,7 @@ use Doctrine\Persistence\ObjectManager;
|
|||
|
||||
class AppFixtures extends Fixture
|
||||
{
|
||||
CONST ADMIN_USER = 'ogadmin';
|
||||
CONST string ADMIN_USER = 'ogadmin';
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
|
@ -19,16 +17,6 @@ class AppFixtures extends Fixture
|
|||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
UserFactory::createOne(['username' => self::ADMIN_USER, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]);
|
||||
$rootUnit = OrganizationalUnitFactory::createOne(['name' => 'Centro de Computación', 'parent' => null]);
|
||||
|
||||
$roomUnit = OrganizationalUnitFactory::createOne([
|
||||
'name' => 'Aula 1',
|
||||
'parent' => $rootUnit
|
||||
]);
|
||||
|
||||
OrganizationalUnitFactory::createOne([
|
||||
'name' => 'Aula 2',
|
||||
'parent' => $roomUnit
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
namespace App\Doctrine;
|
||||
|
||||
use ApiPlatform\Doctrine\Orm\Extension\QueryCollectionExtensionInterface;
|
||||
use ApiPlatform\Doctrine\Orm\Extension\QueryItemExtensionInterface;
|
||||
use ApiPlatform\Doctrine\Orm\Util\QueryNameGeneratorInterface;
|
||||
use ApiPlatform\Metadata\Operation;
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use App\Entity\User;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
|
||||
readonly class UserAllowedOrganizationalUnitExtension implements QueryCollectionExtensionInterface, QueryItemExtensionInterface
|
||||
{
|
||||
public function __construct(
|
||||
private Security $security,
|
||||
)
|
||||
{
|
||||
}
|
||||
public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void
|
||||
{
|
||||
$this->addWhere($queryBuilder, $resourceClass);
|
||||
}
|
||||
|
||||
public function applyToItem(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, array $identifiers, Operation $operation = null, array $context = []): void
|
||||
{
|
||||
$this->addWhere($queryBuilder, $resourceClass);
|
||||
}
|
||||
|
||||
private function addWhere(QueryBuilder $queryBuilder, string $resourceClass): void
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = $this->security->getUser();
|
||||
|
||||
if (OrganizationalUnit::class !== $resourceClass || null === $user || in_array('ROLE_SUPER_ADMIN', $user->getRoles())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$organizationalUnitIds = [];
|
||||
foreach ($user->getAllowedOrganizationalUnits() as $allowedOrganizationalUnit) {
|
||||
$this->addOrganizationalUnitAndChildrenIds($allowedOrganizationalUnit, $organizationalUnitIds);
|
||||
}
|
||||
|
||||
$rootAlias = $queryBuilder->getRootAliases()[0];
|
||||
$queryBuilder->andWhere(sprintf('%s.id in (:ou)', $rootAlias));
|
||||
$queryBuilder->setParameter('ou', $organizationalUnitIds);
|
||||
}
|
||||
|
||||
private function addOrganizationalUnitAndChildrenIds(OrganizationalUnit $organizationalUnit, array &$organizationalUnitIds): void
|
||||
{
|
||||
if (!in_array($organizationalUnit->getId(), $organizationalUnitIds)) {
|
||||
$organizationalUnitIds[] = $organizationalUnit->getId();
|
||||
}
|
||||
|
||||
foreach ($organizationalUnit->getOrganizationalUnits() as $child) {
|
||||
$this->addOrganizationalUnitAndChildrenIds($child, $organizationalUnitIds);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
use App\Dto\Output\OrganizationalUnitOutput;
|
||||
use App\Entity\Client;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
final class ChangeOrganizationalUnitInput
|
||||
{
|
||||
/**
|
||||
* @var Client[]
|
||||
*/
|
||||
#[Assert\GreaterThan(1)]
|
||||
#[Groups(['user-group:write'])]
|
||||
public ?array $clients = [];
|
||||
|
||||
#[Assert\NotNull]
|
||||
#[Groups(['user-group:write'])]
|
||||
public ?OrganizationalUnitOutput $organizationalUnit = null;
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use App\Dto\Output\HardwareProfileOutput;
|
||||
use App\Dto\Output\MenuOutput;
|
||||
use App\Dto\Output\OrganizationalUnitOutput;
|
||||
use App\Entity\Client;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
final class ClientInput
|
||||
{
|
||||
#[Assert\NotBlank]
|
||||
#[Groups(['client:write'])]
|
||||
#[ApiProperty(description: 'The name of the client', example: "Client 1")]
|
||||
public ?string $name = null;
|
||||
|
||||
#[Groups(['client:write'])]
|
||||
#[ApiProperty(description: 'The serial number of the client', example: "123456")]
|
||||
public ?string $serialNumber = null;
|
||||
|
||||
#[Groups(['client:write'])]
|
||||
#[ApiProperty(description: 'The network interface of the client', example: "eth0")]
|
||||
public ?string $netiface = null;
|
||||
|
||||
#[Groups(['client:write'])]
|
||||
#[ApiProperty(description: 'The network driver of the client', example: "e1000e")]
|
||||
public ?string $netDriver = null;
|
||||
|
||||
#[Groups(['client:write'])]
|
||||
#[ApiProperty(description: 'The MAC address of the client', example: "00:11:22:33:44:55")]
|
||||
public ?string $mac = null;
|
||||
|
||||
#[Groups(['client:write'])]
|
||||
#[Assert\Ip]
|
||||
#[ApiProperty(description: 'The IP address of the client', example: "127.0.0.1")]
|
||||
public ?string $ip = null;
|
||||
|
||||
#[Groups(['client:write'])]
|
||||
public ?string $status = null;
|
||||
|
||||
#[Assert\NotNull]
|
||||
#[Groups(['client:write', 'client:patch'])]
|
||||
#[ApiProperty(description: 'The organizational unit of the client')]
|
||||
public ?OrganizationalUnitOutput $organizationalUnit = null;
|
||||
|
||||
#[Groups(['client:write'])]
|
||||
public ?MenuOutput $menu = null;
|
||||
|
||||
#[Groups(['client:write'])]
|
||||
public ?HardwareProfileOutput $hardwareProfile = null;
|
||||
|
||||
public function __construct(?Client $client = null)
|
||||
{
|
||||
if (!$client) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->name = $client->getName();
|
||||
$this->serialNumber = $client->getSerialNumber();
|
||||
$this->netiface = $client->getNetiface();
|
||||
$this->organizationalUnit = new OrganizationalUnitOutput($client->getOrganizationalUnit());
|
||||
$this->netDriver = $client->getNetDriver();
|
||||
$this->mac = $client->getMac();
|
||||
$this->ip = $client->getIp();
|
||||
$this->status = $client->getStatus();
|
||||
|
||||
if ($client->getMenu()) {
|
||||
$this->menu = new MenuOutput($client->getMenu());
|
||||
}
|
||||
|
||||
if ($client->getHardwareProfile()) {
|
||||
$this->hardwareProfile = new HardwareProfileOutput($client->getHardwareProfile());
|
||||
}
|
||||
}
|
||||
|
||||
public function createOrUpdateEntity(?Client $client = null): Client
|
||||
{
|
||||
if (!$client) {
|
||||
$client = new Client();
|
||||
}
|
||||
|
||||
$client->setName($this->name);
|
||||
$client->setSerialNumber($this->serialNumber);
|
||||
$client->setNetiface($this->netiface);
|
||||
$client->setOrganizationalUnit($this->organizationalUnit->getEntity());
|
||||
$client->setNetDriver($this->netDriver);
|
||||
$client->setMac($this->mac);
|
||||
$client->setIp($this->ip);
|
||||
$client->setStatus($this->status);
|
||||
$client->setMenu($this->menu?->getEntity());
|
||||
$client->setHardwareProfile($this->hardwareProfile?->getEntity());
|
||||
|
||||
return $client;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use App\Dto\Output\HardwareTypeOutput;
|
||||
use App\Entity\Hardware;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
final class HardwareInput
|
||||
{
|
||||
#[Assert\NotBlank]
|
||||
#[Groups(['hardware:write'])]
|
||||
#[ApiProperty(description: 'The name of the hardware', example: "Hardware 1")]
|
||||
public ?string $name = null;
|
||||
|
||||
#[Groups(['hardware:write'])]
|
||||
#[ApiProperty(description: 'The description of the hardware', example: "Hardware 1 description")]
|
||||
public ?string $description = null;
|
||||
|
||||
#[Assert\NotNull]
|
||||
#[Groups(['hardware:write'])]
|
||||
#[ApiProperty(description: 'The type of the hardware', example: "Server")]
|
||||
public ?HardwareTypeOutput $type = null;
|
||||
|
||||
public function __construct(?Hardware $hardware = null)
|
||||
{
|
||||
if (!$hardware) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->name = $hardware->getName();
|
||||
$this->description = $hardware->getDescription();
|
||||
$this->type = new HardwareTypeOutput($hardware->getType());
|
||||
}
|
||||
|
||||
public function createOrUpdateEntity(?Hardware $hardware = null): Hardware
|
||||
{
|
||||
if (!$hardware) {
|
||||
$hardware = new Hardware();
|
||||
}
|
||||
|
||||
$hardware->setName($this->name);
|
||||
$hardware->setDescription($this->description);
|
||||
$hardware->setType($this->type->getEntity());
|
||||
|
||||
return $hardware;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use App\Dto\Output\OrganizationalUnitOutput;
|
||||
use App\Entity\HardwareProfile;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
final class HardwareProfileInput
|
||||
{
|
||||
#[Groups(['hardware-profile:write'])]
|
||||
#[ApiProperty(description: 'The description of the hardware profile', example: "Hardware 1 description")]
|
||||
public ?string $description = null;
|
||||
|
||||
#[Groups(['hardware-profile:write'])]
|
||||
#[ApiProperty(description: 'Comments of the hardware profile', example: "Hardware 1")]
|
||||
public ?string $comments = null;
|
||||
|
||||
#[Groups(['hardware-profile:write'])]
|
||||
#[ApiProperty(description: 'The organizational unit of the hardware profile')]
|
||||
public ?OrganizationalUnitOutput $organizationalUnit = null;
|
||||
|
||||
public function __construct(?HardwareProfile $hardwareProfile = null)
|
||||
{
|
||||
if (!$hardwareProfile) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->description = $hardwareProfile->getDescription();
|
||||
$this->comments = $hardwareProfile->getComments();
|
||||
if($hardwareProfile->getOrganizationalUnit()) {
|
||||
$this->organizationalUnit = new OrganizationalUnitOutput($hardwareProfile->getOrganizationalUnit());
|
||||
}
|
||||
}
|
||||
|
||||
public function createOrUpdateEntity(?HardwareProfile $hardwareProfile = null): HardwareProfile
|
||||
{
|
||||
if (!$hardwareProfile) {
|
||||
$hardwareProfile = new HardwareProfile();
|
||||
}
|
||||
|
||||
$hardwareProfile->setDescription($this->description);
|
||||
$hardwareProfile->setComments($this->comments);
|
||||
if ($this->organizationalUnit) {
|
||||
$hardwareProfile->setOrganizationalUnit($this->organizationalUnit->getEntity());
|
||||
}
|
||||
|
||||
return $hardwareProfile;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
use App\Entity\HardwareType;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
class HardwareTypeInput
|
||||
{
|
||||
#[Assert\NotBlank]
|
||||
#[Groups(['hardware-type:write'])]
|
||||
public ?string $name = null;
|
||||
|
||||
public function __construct(?HardwareType $hardwareType = null)
|
||||
{
|
||||
if (!$hardwareType) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->name = $hardwareType->getName();
|
||||
}
|
||||
|
||||
public function createOrUpdateEntity(?HardwareType $hardwareType = null): HardwareType
|
||||
{
|
||||
if (!$hardwareType) {
|
||||
$hardwareType = new HardwareType();
|
||||
}
|
||||
|
||||
$hardwareType->setName($this->name);
|
||||
|
||||
return $hardwareType;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use App\Dto\Output\ClientOutput;
|
||||
use App\Dto\Output\SoftwareProfileOutput;
|
||||
use App\Entity\Image;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
final class ImageInput
|
||||
{
|
||||
#[Assert\NotBlank]
|
||||
#[Groups(['image:write'])]
|
||||
#[ApiProperty(description: 'The name of the image', example: "Image 1")]
|
||||
public ?string $name = null;
|
||||
|
||||
#[Groups(['image:write'])]
|
||||
#[ApiProperty(description: 'The description of the image', example: "Image 1 description")]
|
||||
public ?string $description = null;
|
||||
|
||||
#[Groups(['image:write'])]
|
||||
#[ApiProperty(description: 'The comments of the image', example: "Image 1 comments")]
|
||||
public ?string $comments = null;
|
||||
|
||||
#[Groups(['image:write'])]
|
||||
#[ApiProperty(description: 'The type of the image', example: "Server")]
|
||||
public ?string $type = null;
|
||||
|
||||
#[Groups(['image:write'])]
|
||||
#[ApiProperty(description: 'The path of the image', example: "/path/to/image")]
|
||||
public ?string $path = null;
|
||||
|
||||
#[Groups(['image:write'])]
|
||||
#[ApiProperty(description: 'The revision of the image', example: "1.0")]
|
||||
public ?string $revision = null;
|
||||
|
||||
#[Groups(['image:write'])]
|
||||
#[ApiProperty(description: 'The info of the image', example: "Image 1 info")]
|
||||
public ?string $info = null;
|
||||
|
||||
#[Groups(['image:write'])]
|
||||
#[ApiProperty(description: 'The size of the image', example: 1024)]
|
||||
public ?int $size = null;
|
||||
|
||||
#[Groups(['image:write'])]
|
||||
#[ApiProperty(description: 'The client of the image')]
|
||||
public ?ClientOutput $client = null;
|
||||
|
||||
#[Groups(['image:write'])]
|
||||
#[ApiProperty(description: 'The software profile of the image')]
|
||||
public ?SoftwareProfileOutput $softwareProfile = null;
|
||||
|
||||
public function __construct(?Image $image = null)
|
||||
{
|
||||
if (!$image) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->name = $image->getName();
|
||||
$this->description = $image->getDescription();
|
||||
$this->comments = $image->getComments();
|
||||
$this->type = $image->getType();
|
||||
$this->path = $image->getPath();
|
||||
$this->revision = $image->getRevision();
|
||||
$this->info = $image->getInfo();
|
||||
$this->size = $image->getSize();
|
||||
$this->client = new ClientOutput($image->getClient());
|
||||
$this->softwareProfile = new SoftwareProfileOutput($image->getSoftwareProfile());
|
||||
}
|
||||
|
||||
public function createOrUpdateEntity(?Image $image = null): Image
|
||||
{
|
||||
if (!$image) {
|
||||
$image = new Image();
|
||||
}
|
||||
|
||||
$image->setName($this->name);
|
||||
$image->setDescription($this->description);
|
||||
$image->setComments($this->comments);
|
||||
$image->setType($this->type);
|
||||
$image->setPath($this->path);
|
||||
$image->setRevision($this->revision);
|
||||
$image->setInfo($this->info);
|
||||
$image->setSize($this->size);
|
||||
$image->setClient($this->client->getEntity());
|
||||
$image->setSoftwareProfile($this->softwareProfile->getEntity());
|
||||
|
||||
return $image;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use App\Dto\Output\OrganizationalUnitOutput;
|
||||
use App\Entity\HardwareProfile;
|
||||
use App\Entity\Menu;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
final class MenuInput
|
||||
{
|
||||
#[Assert\NotNull()]
|
||||
#[Groups(['menu:write'])]
|
||||
#[ApiProperty(description: 'The name of the menu', example: "Menu 1")]
|
||||
public ?string $name = null;
|
||||
|
||||
#[Assert\NotNull()]
|
||||
#[Groups(['menu:write'])]
|
||||
#[ApiProperty(description: 'The title of the menu', example: "Menu 1 title")]
|
||||
public ?string $title = null;
|
||||
|
||||
#[Groups(['menu:write'])]
|
||||
#[ApiProperty(description: 'Comments of the menu', example: "Menu 1 comments")]
|
||||
public ?string $comments = null;
|
||||
|
||||
#[Assert\NotNull()]
|
||||
#[Groups(['menu:write'])]
|
||||
#[ApiProperty(description: 'The resolution of the menu', example: "1920x1080")]
|
||||
public ?string $resolution = null;
|
||||
|
||||
#[Groups(['menu:write'])]
|
||||
#[ApiProperty(description: 'The public url of the menu', example: "http://example.com")]
|
||||
public ?string $publicUrl = null;
|
||||
|
||||
#[Groups(['menu:write'])]
|
||||
#[ApiProperty(description: 'The private url of the menu', example: "http://example.com")]
|
||||
public ?string $privateUrl = null;
|
||||
|
||||
public function __construct(?Menu $menu = null)
|
||||
{
|
||||
if (!$menu) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->name = $menu->getName();
|
||||
$this->title = $menu->getTitle();
|
||||
$this->comments = $menu->getComments();
|
||||
$this->resolution = $menu->getResolution();
|
||||
$this->publicUrl = $menu->getPublicUrl();
|
||||
$this->privateUrl = $menu->getPrivateUrl();
|
||||
}
|
||||
|
||||
public function createOrUpdateEntity(?Menu $menu = null): Menu
|
||||
{
|
||||
if (!$menu) {
|
||||
$menu = new Menu();
|
||||
}
|
||||
|
||||
$menu->setName($this->name);
|
||||
$menu->setTitle($this->title);
|
||||
$menu->setComments($this->comments);
|
||||
$menu->setResolution($this->resolution);
|
||||
$menu->setPublicUrl($this->publicUrl);
|
||||
$menu->setPrivateUrl($this->privateUrl);
|
||||
|
||||
return $menu;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
use App\Dto\Output\HardwareProfileOutput;
|
||||
use App\Dto\Output\MenuOutput;
|
||||
use App\Entity\HardwareProfile;
|
||||
use App\Entity\Menu;
|
||||
use App\Entity\NetworkSettings;
|
||||
use App\Validator\Constraints\OrganizationalUnitMulticastMode;
|
||||
use App\Validator\Constraints\OrganizationalUnitMulticastPort;
|
||||
use App\Validator\Constraints\OrganizationalUnitP2PMode;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
class NetworkSettingsInput
|
||||
{
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?string $proxy = null;
|
||||
|
||||
#[Assert\Ip()]
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?string $dns = null;
|
||||
|
||||
#[Assert\Ip()]
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?string $netmask = null;
|
||||
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?string $router = null;
|
||||
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?string $ntp = null;
|
||||
|
||||
#[OrganizationalUnitP2PMode]
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?string $p2pMode = null;
|
||||
|
||||
#[Assert\GreaterThan(0)]
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?int $p2pTime = null;
|
||||
|
||||
#[Assert\Ip()]
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?string $mcastIp = null;
|
||||
|
||||
#[Assert\GreaterThan(0)]
|
||||
#[Groups(['organizational-write:write'])]
|
||||
public ?int $mcastSpeed = null;
|
||||
|
||||
#[OrganizationalUnitMulticastPort]
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?int $mcastPort = null;
|
||||
|
||||
#[OrganizationalUnitMulticastMode]
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?string $mcastMode = null;
|
||||
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?MenuOutput $menu = null;
|
||||
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?HardwareProfileOutput $hardwareProfile = null;
|
||||
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?bool $validation = null;
|
||||
|
||||
public function __construct(?NetworkSettings $networkSettings = null)
|
||||
{
|
||||
if (!$networkSettings) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->proxy = $networkSettings->getProxy();
|
||||
$this->dns = $networkSettings->getDns();
|
||||
$this->netmask = $networkSettings->getNetmask();
|
||||
$this->router = $networkSettings->getRouter();
|
||||
$this->ntp = $networkSettings->getNtp();
|
||||
$this->p2pMode = $networkSettings->getP2pMode();
|
||||
$this->p2pTime = $networkSettings->getP2pTime();
|
||||
$this->mcastIp = $networkSettings->getMcastIp();
|
||||
$this->mcastSpeed = $networkSettings->getMcastSpeed();
|
||||
$this->mcastPort = $networkSettings->getMcastPort();
|
||||
$this->mcastMode = $networkSettings->getMcastMode();
|
||||
|
||||
if ($networkSettings->getMenu()) {
|
||||
$this->menu = new MenuOutput($networkSettings->getMenu());
|
||||
}
|
||||
|
||||
if ($networkSettings->getHardwareProfile()) {
|
||||
$this->hardwareProfile = new HardwareProfileOutput($networkSettings->getHardwareProfile());
|
||||
}
|
||||
|
||||
$this->validation = $networkSettings->getValidation();
|
||||
}
|
||||
|
||||
public function createOrUpdateEntity(?NetworkSettings $networkSettings = null): NetworkSettings
|
||||
{
|
||||
if (!$networkSettings) {
|
||||
$networkSettings = new NetworkSettings();
|
||||
}
|
||||
|
||||
$networkSettings->setProxy($this->proxy);
|
||||
$networkSettings->setDns($this->dns);
|
||||
$networkSettings->setNetmask($this->netmask);
|
||||
$networkSettings->setRouter($this->router);
|
||||
$networkSettings->setNtp($this->ntp);
|
||||
$networkSettings->setP2pMode($this->p2pMode);
|
||||
$networkSettings->setP2pTime($this->p2pTime);
|
||||
$networkSettings->setMcastIp($this->mcastIp);
|
||||
$networkSettings->setMcastSpeed($this->mcastSpeed);
|
||||
$networkSettings->setMcastPort($this->mcastPort);
|
||||
$networkSettings->setMcastMode($this->mcastMode);
|
||||
|
||||
if ($this->menu) {
|
||||
$networkSettings->setMenu($this->menu->getEntity());
|
||||
}
|
||||
|
||||
if ($this->hardwareProfile) {
|
||||
$networkSettings->setHardwareProfile($this->hardwareProfile->getEntity());
|
||||
}
|
||||
|
||||
$networkSettings->setValidation($this->validation);
|
||||
|
||||
return $networkSettings;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
use App\Entity\OperativeSystem;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
class OperativeSystemInput
|
||||
{
|
||||
#[Assert\NotBlank]
|
||||
#[Groups(['operative-system:write'])]
|
||||
public ?string $name = null;
|
||||
|
||||
public function __construct(?OperativeSystem $operativeSystem = null)
|
||||
{
|
||||
if (!$operativeSystem) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->name = $operativeSystem->getName();
|
||||
}
|
||||
|
||||
public function createOrUpdateEntity(?OperativeSystem $operativeSystem = null): OperativeSystem
|
||||
{
|
||||
if (!$operativeSystem) {
|
||||
$operativeSystem = new OperativeSystem();
|
||||
}
|
||||
|
||||
$operativeSystem->setName($this->name);
|
||||
|
||||
return $operativeSystem;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,16 +2,54 @@
|
|||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use App\Dto\Output\OrganizationalUnitOutput;
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use App\Validator\Constraints\OrganizationalUnitMulticastMode;
|
||||
use App\Validator\Constraints\OrganizationalUnitMulticastPort;
|
||||
use App\Validator\Constraints\OrganizationalUnitP2PMode;
|
||||
use App\Validator\Constraints\OrganizationalUnitParent;
|
||||
use App\Validator\Constraints\OrganizationalUnitType;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
final class OrganizationalUnitInput
|
||||
#[OrganizationalUnitParent]
|
||||
class OrganizationalUnitInput
|
||||
{
|
||||
#[Assert\NotBlank]
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?string $name = null;
|
||||
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?OrganizationalUnitOutput $parent = null;
|
||||
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?string $description = null;
|
||||
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?string $location = null;
|
||||
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?bool $projector = null;
|
||||
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?bool $board = null;
|
||||
|
||||
#[Assert\GreaterThan(0)]
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?int $capacity = null;
|
||||
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
public ?string $comments = null;
|
||||
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
#[OrganizationalUnitType]
|
||||
public ?string $type = null;
|
||||
|
||||
#[Groups(['organizational-unit:write'])]
|
||||
#[Assert\Valid()]
|
||||
public ?NetworkSettingsInput $networkSettings = null;
|
||||
|
||||
public function __construct(?OrganizationalUnit $organizationalUnit = null)
|
||||
{
|
||||
if (!$organizationalUnit) {
|
||||
|
@ -19,6 +57,19 @@ final class OrganizationalUnitInput
|
|||
}
|
||||
|
||||
$this->name = $organizationalUnit->getName();
|
||||
if ($organizationalUnit->getParent()) {
|
||||
$this->parent = new OrganizationalUnitOutput($organizationalUnit->getParent());
|
||||
}
|
||||
$this->description = $organizationalUnit->getDescription();
|
||||
$this->location = $organizationalUnit->getLocation();
|
||||
$this->projector = $organizationalUnit->isProjector();
|
||||
$this->board = $organizationalUnit->isBoard();
|
||||
$this->capacity = $organizationalUnit->getCapacity();
|
||||
$this->comments = $organizationalUnit->getComments();
|
||||
$this->type = $organizationalUnit->getType();
|
||||
if ($organizationalUnit->getNetworkSettings()){
|
||||
$this->networkSettings = new NetworkSettingsInput($organizationalUnit->getNetworkSettings());
|
||||
}
|
||||
}
|
||||
|
||||
public function createOrUpdateEntity(?OrganizationalUnit $organizationalUnit = null): OrganizationalUnit
|
||||
|
@ -28,6 +79,20 @@ final class OrganizationalUnitInput
|
|||
}
|
||||
|
||||
$organizationalUnit->setName($this->name);
|
||||
if ($this->parent) {
|
||||
$organizationalUnit->setParent($this->parent->getEntity());
|
||||
}
|
||||
$organizationalUnit->setDescription($this->description);
|
||||
$organizationalUnit->setLocation($this->location);
|
||||
$organizationalUnit->setProjector($this->projector);
|
||||
$organizationalUnit->setBoard($this->board);
|
||||
$organizationalUnit->setCapacity($this->capacity);
|
||||
$organizationalUnit->setComments($this->comments);
|
||||
$organizationalUnit->setType($this->type);
|
||||
|
||||
if ($this->networkSettings){
|
||||
$organizationalUnit->setNetworkSettings($this->networkSettings->createOrUpdateEntity($organizationalUnit->getNetworkSettings()));
|
||||
}
|
||||
|
||||
return $organizationalUnit;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use App\Dto\Output\ClientOutput;
|
||||
use App\Dto\Output\OperativeSystemOutput;
|
||||
use App\Dto\Output\OrganizationalUnitOutput;
|
||||
use App\Entity\HardwareProfile;
|
||||
use App\Entity\Menu;
|
||||
use App\Entity\Partition;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
final class PartitionInput
|
||||
{
|
||||
#[Groups(['partition:write'])]
|
||||
#[ApiProperty(description: 'The disk number of the partition', example: 1)]
|
||||
public ?int $diskNumber = null;
|
||||
|
||||
#[Groups(['partition:write'])]
|
||||
#[ApiProperty(description: 'The number of the partition', example: 1)]
|
||||
public ?int $partitionNumber = null;
|
||||
|
||||
#[Groups(['partition:write'])]
|
||||
#[ApiProperty(description: 'The code of the partition', example: "code")]
|
||||
public ?string $partitionCode = null;
|
||||
|
||||
#[Assert\NotNull()]
|
||||
#[Groups(['partition:write'])]
|
||||
#[ApiProperty(description: 'The size of the partition', example: 100)]
|
||||
public ?int $size = null;
|
||||
|
||||
#[Groups(['partition:write'])]
|
||||
#[ApiProperty(description: 'The cache content of the partition', example: "cache content")]
|
||||
public ?string $cacheContent = null;
|
||||
|
||||
#[Groups(['partition:write'])]
|
||||
#[ApiProperty(description: 'The filesystem of the partition', example: "filesystem")]
|
||||
public ?string $filesystem = null;
|
||||
|
||||
#[Assert\NotNull()]
|
||||
#[Groups(['partition:write'])]
|
||||
#[ApiProperty(description: 'The operative system name of the partition', example: "Ubuntu")]
|
||||
public ?OperativeSystemOutput $operativeSystem = null;
|
||||
|
||||
#[Assert\NotNull()]
|
||||
#[Groups(['partition:write'])]
|
||||
#[ApiProperty(description: 'The client of the partition')]
|
||||
public ?ClientOutput $client = null;
|
||||
|
||||
#[Assert\NotNull()]
|
||||
#[Groups(['partition:write'])]
|
||||
#[ApiProperty(description: 'The memory usage of the partition', example: 100)]
|
||||
public ?int $memoryUsage = null;
|
||||
|
||||
public function __construct(?Partition $partition = null)
|
||||
{
|
||||
if (!$partition) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->diskNumber = $partition->getDiskNumber();
|
||||
$this->partitionNumber = $partition->getPartitionNumber();
|
||||
$this->partitionCode = $partition->getPartitionCode();
|
||||
$this->size = $partition->getSize();
|
||||
$this->cacheContent = $partition->getCacheContent();
|
||||
$this->filesystem = $partition->getFilesystem();
|
||||
$this->operativeSystem = new OperativeSystemOutput($partition->getOperativeSystem());
|
||||
$this->client = new ClientOutput($partition->getClient());
|
||||
$this->memoryUsage = $partition->getMemoryUsage();
|
||||
}
|
||||
|
||||
public function createOrUpdateEntity(?Partition $partition = null): Partition
|
||||
{
|
||||
if (!$partition) {
|
||||
$partition = new Partition();
|
||||
}
|
||||
|
||||
$partition->setDiskNumber($this->diskNumber);
|
||||
$partition->setPartitionNumber($this->partitionNumber);
|
||||
$partition->setPartitionCode($this->partitionCode);
|
||||
$partition->setSize($this->size * 100);
|
||||
$partition->setCacheContent($this->cacheContent);
|
||||
$partition->setFilesystem($this->filesystem);
|
||||
$partition->setOperativeSystem($this->operativeSystem->getEntity());
|
||||
$partition->setClient($this->client->getEntity());
|
||||
$partition->setMemoryUsage($this->memoryUsage * 100);
|
||||
|
||||
return $partition;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use App\Entity\Software;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
final class SoftwareInput
|
||||
{
|
||||
#[Assert\NotBlank]
|
||||
#[Groups(['software:write'])]
|
||||
#[ApiProperty(description: 'The name of the software', example: "Software 1")]
|
||||
public ?string $name = null;
|
||||
|
||||
#[Groups(['software:write'])]
|
||||
#[ApiProperty(description: 'The description of the software', example: "Software 1 description")]
|
||||
public ?string $description = null;
|
||||
|
||||
public function __construct(?Software $software = null)
|
||||
{
|
||||
if (!$software) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->name = $software->getName();
|
||||
$this->description = $software->getDescription();
|
||||
}
|
||||
|
||||
public function createOrUpdateEntity(?Software $software = null): Software
|
||||
{
|
||||
if (!$software) {
|
||||
$software = new Software();
|
||||
}
|
||||
|
||||
$software->setName($this->name);
|
||||
$software->setDescription($this->description);
|
||||
|
||||
return $software;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Input;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use App\Dto\Output\OrganizationalUnitOutput;
|
||||
use App\Entity\SoftwareProfile;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
final class SoftwareProfileInput
|
||||
{
|
||||
#[Groups(['software-profile:write'])]
|
||||
#[ApiProperty(description: 'The description of the software profile', example: "Software 1 description")]
|
||||
public ?string $description = null;
|
||||
|
||||
#[Groups(['software-profile:write'])]
|
||||
#[ApiProperty(description: 'Comments of the software profile', example: "Software 1")]
|
||||
public ?string $comments = null;
|
||||
|
||||
#[Groups(['software-profile:write'])]
|
||||
#[ApiProperty(description: 'The organizational unit of the software profile')]
|
||||
public ?OrganizationalUnitOutput $organizationalUnit = null;
|
||||
|
||||
public function __construct(?SoftwareProfile $softwareProfile = null)
|
||||
{
|
||||
if (!$softwareProfile) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->description = $softwareProfile->getDescription();
|
||||
$this->comments = $softwareProfile->getComments();
|
||||
if($softwareProfile->getOrganizationalUnit()) {
|
||||
$this->organizationalUnit = new OrganizationalUnitOutput($softwareProfile->getOrganizationalUnit());
|
||||
}
|
||||
}
|
||||
|
||||
public function createOrUpdateEntity(?SoftwareProfile $softwareProfile = null): SoftwareProfile
|
||||
{
|
||||
if (!$softwareProfile) {
|
||||
$softwareProfile = new SoftwareProfile();
|
||||
}
|
||||
|
||||
$softwareProfile->setDescription($this->description);
|
||||
$softwareProfile->setComments($this->comments);
|
||||
if ($this->organizationalUnit) {
|
||||
$softwareProfile->setOrganizationalUnit($this->organizationalUnit->getEntity());
|
||||
}
|
||||
|
||||
return $softwareProfile;
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Dto\Input;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use App\Dto\Output\OrganizationalUnitOutput;
|
||||
use App\Dto\Output\UserGroupOutput;
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use App\Entity\User;
|
||||
|
@ -17,7 +18,7 @@ final class UserInput
|
|||
public ?string $username = null;
|
||||
|
||||
/**
|
||||
* @var OrganizationalUnit[]
|
||||
* @var OrganizationalUnitOutput[]
|
||||
*/
|
||||
#[Groups('user:write')]
|
||||
#[ApiProperty(readableLink: false, writableLink: false)]
|
||||
|
@ -33,7 +34,7 @@ final class UserInput
|
|||
public ?bool $enabled = true;
|
||||
|
||||
/**
|
||||
* @var UserGroup[]
|
||||
* @var UserGroupOutput[]
|
||||
*/
|
||||
#[Groups('user:write')]
|
||||
#[ApiProperty(readableLink: false, writableLink: false)]
|
||||
|
@ -62,8 +63,18 @@ final class UserInput
|
|||
|
||||
$this->username = $user->getUsername();
|
||||
$this->enabled= $user->isEnabled();
|
||||
$this->userGroups = $user->getUserGroups()->toArray();
|
||||
$this->allowedOrganizationalUnits = $user->getAllowedOrganizationalUnits()->toArray();
|
||||
|
||||
if ($user->getUserGroups()) {
|
||||
foreach ($user->getUserGroups() as $userGroup) {
|
||||
$this->userGroups[] = new UserGroupOutput($userGroup);
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->getAllowedOrganizationalUnits()) {
|
||||
foreach ($user->getAllowedOrganizationalUnits() as $allowedOrganizationalUnit) {
|
||||
$this->allowedOrganizationalUnits[] = new OrganizationalUnitOutput($allowedOrganizationalUnit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function createOrUpdateEntity(?User $user = null): User
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Partition;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
#[Get(shortName: 'Client')]
|
||||
final class ClientOutput extends AbstractOutput
|
||||
{
|
||||
CONST string TYPE = 'client';
|
||||
|
||||
#[Groups(['client:read', 'organizational-unit:read'])]
|
||||
public string $name;
|
||||
|
||||
#[Groups(['client:read', 'organizational-unit:read'])]
|
||||
public string $type = self::TYPE;
|
||||
|
||||
#[Groups(['client:read', 'organizational-unit:read'])]
|
||||
public ?string $ip = '';
|
||||
|
||||
#[Groups(['client:read', 'organizational-unit:read'])]
|
||||
public ?string $mac = '';
|
||||
|
||||
#[Groups(['client:read', 'organizational-unit:read'])]
|
||||
public ?string $serialNumber = '';
|
||||
|
||||
#[Groups(['client:read'])]
|
||||
public ?string $netiface = '';
|
||||
|
||||
#[Groups(['client:read'])]
|
||||
public ?string $netDriver = '';
|
||||
|
||||
#[Groups(['client:read'])]
|
||||
#[ApiProperty(readableLink: true)]
|
||||
public ?OrganizationalUnitOutput $organizationalUnit = null;
|
||||
|
||||
#[Groups(['client:read'])]
|
||||
public array $partitions = [];
|
||||
|
||||
#[Groups(['client:read'])]
|
||||
public ?MenuOutput $menu = null;
|
||||
|
||||
#[Groups(['client:read'])]
|
||||
#[ApiProperty(readableLink: true )]
|
||||
public ?HardwareProfileOutput $hardwareProfile = null;
|
||||
|
||||
#[Groups(['client:read'])]
|
||||
public \DateTime $createdAt;
|
||||
|
||||
#[Groups(['client:read'])]
|
||||
public ?string $createdBy = null;
|
||||
|
||||
public function __construct(Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
|
||||
$this->name = $client->getName();
|
||||
$this->serialNumber = $client->getSerialNumber();
|
||||
$this->mac = $client->getMac();
|
||||
$this->ip = $client->getIp();
|
||||
$this->netiface = $client->getNetiface();
|
||||
$this->netDriver = $client->getNetDriver();
|
||||
|
||||
if ($client->getOrganizationalUnit()) {
|
||||
$this->organizationalUnit = new OrganizationalUnitOutput($client->getOrganizationalUnit());
|
||||
}
|
||||
|
||||
$this->partitions = $client->getPartitions()->map(
|
||||
fn(Partition $partition) => new PartitionOutput($partition)
|
||||
)->toArray();
|
||||
|
||||
$this->menu = $client->getMenu() ? new MenuOutput($client->getMenu()) : null;
|
||||
$this->hardwareProfile = $client->getHardwareProfile() ? new HardwareProfileOutput($client->getHardwareProfile()) : null;
|
||||
|
||||
$this->createdAt = $client->getCreatedAt();
|
||||
$this->createdBy = $client->getCreatedBy();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Entity\Hardware;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
#[Get(shortName: 'Hardware')]
|
||||
final class HardwareOutput extends AbstractOutput
|
||||
{
|
||||
#[Groups(['hardware:read', 'hardware-profile:read'])]
|
||||
public string $name;
|
||||
|
||||
#[Groups(['hardware:read'])]
|
||||
public ?string $description = '';
|
||||
|
||||
#[Groups(['hardware:read'])]
|
||||
#[ApiProperty(readableLink: true)]
|
||||
public ?HardwareTypeOutput $type = null;
|
||||
|
||||
#[Groups(['hardware:read'])]
|
||||
public \DateTime $createdAt;
|
||||
|
||||
#[Groups(['hardware:read'])]
|
||||
public ?string $createdBy = null;
|
||||
|
||||
public function __construct(Hardware $hardware)
|
||||
{
|
||||
parent::__construct($hardware);
|
||||
|
||||
$this->name = $hardware->getName();
|
||||
$this->description = $hardware->getDescription();
|
||||
$this->type = new HardwareTypeOutput($hardware->getType());
|
||||
$this->createdAt = $hardware->getCreatedAt();
|
||||
$this->createdBy = $hardware->getCreatedBy();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Entity\Hardware;
|
||||
use App\Entity\HardwareProfile;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
#[Get(shortName: 'HardwareProfile')]
|
||||
final class HardwareProfileOutput extends AbstractOutput
|
||||
{
|
||||
#[Groups(['hardware-profile:read', 'client:read', 'organizational-unit:read'])]
|
||||
public ?string $description = '';
|
||||
|
||||
#[Groups(['hardware-profile:read'])]
|
||||
public ?string $comments = '';
|
||||
|
||||
#[Groups(['hardware-profile:read'])]
|
||||
public ?OrganizationalUnitOutput $organizationalUnit = null;
|
||||
|
||||
#[Groups(['hardware-profile:read'])]
|
||||
public ?array $hardwareCollection = [];
|
||||
|
||||
#[Groups(['hardware-profile:read'])]
|
||||
public \DateTime $createdAt;
|
||||
|
||||
#[Groups(['hardware-profile:read'])]
|
||||
public ?string $createdBy = null;
|
||||
|
||||
public function __construct(HardwareProfile $hardwareProfile)
|
||||
{
|
||||
parent::__construct($hardwareProfile);
|
||||
|
||||
$this->description = $hardwareProfile->getDescription();
|
||||
$this->comments = $hardwareProfile->getComments();
|
||||
if($hardwareProfile->getOrganizationalUnit()) {
|
||||
$this->organizationalUnit = new OrganizationalUnitOutput($hardwareProfile->getOrganizationalUnit());
|
||||
}
|
||||
|
||||
$this->hardwareCollection = $hardwareProfile->getHardwareCollection()->map(
|
||||
fn(Hardware $hardware) => new HardwareOutput($hardware)
|
||||
)->toArray();
|
||||
|
||||
$this->createdAt = $hardwareProfile->getCreatedAt();
|
||||
$this->createdBy = $hardwareProfile->getCreatedBy();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Entity\HardwareType;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
#[Get(shortName: 'HardwareType')]
|
||||
final class HardwareTypeOutput extends AbstractOutput
|
||||
{
|
||||
#[Groups(['hardware-type:read', 'hardware:read'])]
|
||||
public string $name;
|
||||
|
||||
public function __construct(HardwareType $hardwareType)
|
||||
{
|
||||
parent::__construct($hardwareType);
|
||||
|
||||
$this->name = $hardwareType->getName();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Entity\Image;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
#[Get(shortName: 'Image')]
|
||||
final class ImageOutput extends AbstractOutput
|
||||
{
|
||||
#[Groups(['image:read'])]
|
||||
public ?string $name = '';
|
||||
|
||||
#[Groups(['image:read'])]
|
||||
public ?string $description = '';
|
||||
|
||||
#[Groups(['image:read'])]
|
||||
public ?string $comments = '';
|
||||
|
||||
#[Groups(['image:read'])]
|
||||
public ?string $type = '';
|
||||
|
||||
#[Groups(['image:read'])]
|
||||
public ?string $path = '';
|
||||
|
||||
#[Groups(['image:read'])]
|
||||
public ?string $revision = '';
|
||||
|
||||
#[Groups(['image:read'])]
|
||||
public ?string $info = '';
|
||||
|
||||
#[Groups(['image:read'])]
|
||||
public ?int $size = null;
|
||||
|
||||
#[Groups(['image:read'])]
|
||||
public ?ClientOutput $clientOutput = null;
|
||||
|
||||
#[Groups(['image:read'])]
|
||||
public ?SoftwareProfileOutput $softwareProfile = null;
|
||||
|
||||
public function __construct(Image $image)
|
||||
{
|
||||
parent::__construct($image);
|
||||
|
||||
$this->name = $image->getName();
|
||||
$this->description = $image->getDescription();
|
||||
$this->comments = $image->getComments();
|
||||
$this->type = $image->getType();
|
||||
$this->path = $image->getPath();
|
||||
$this->revision = $image->getRevision();
|
||||
$this->info = $image->getInfo();
|
||||
$this->size = $image->getSize();
|
||||
$this->clientOutput = new ClientOutput($image->getClient());
|
||||
$this->softwareProfile = new SoftwareProfileOutput($image->getSoftwareProfile());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Entity\HardwareProfile;
|
||||
use App\Entity\Menu;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
#[Get(shortName: 'Menu')]
|
||||
final class MenuOutput extends AbstractOutput
|
||||
{
|
||||
#[Groups(['menu:read', 'organizational-unit:read'])]
|
||||
public string $name;
|
||||
|
||||
#[Groups(['menu:read'])]
|
||||
public ?string $title = null;
|
||||
|
||||
#[Groups(['menu:read'])]
|
||||
public string $resolution;
|
||||
|
||||
#[Groups(['menu:read'])]
|
||||
public ?string $comments = null;
|
||||
|
||||
#[Groups(['menu:read'])]
|
||||
public ?string $publicUrl = null;
|
||||
|
||||
#[Groups(['menu:read'])]
|
||||
public ?string $privateUrl = null;
|
||||
|
||||
#[Groups(['menu:read'])]
|
||||
public \DateTime $createdAt;
|
||||
|
||||
#[Groups(['menu:read'])]
|
||||
public ?string $createdBy = null;
|
||||
|
||||
public function __construct(Menu $menu)
|
||||
{
|
||||
parent::__construct($menu);
|
||||
|
||||
$this->name = $menu->getName();
|
||||
$this->title = $menu->getTitle();
|
||||
$this->resolution = $menu->getResolution();
|
||||
$this->comments = $menu->getComments();
|
||||
$this->publicUrl = $menu->getPublicUrl();
|
||||
$this->privateUrl = $menu->getPrivateUrl();
|
||||
$this->createdAt = $menu->getCreatedAt();
|
||||
$this->createdBy = $menu->getCreatedBy();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Entity\NetworkSettings;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
#[Get(shortName: 'NetworkSettings')]
|
||||
final class NetworkSettingsOutput extends AbstractOutput
|
||||
{
|
||||
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
|
||||
public ?string $proxy = null;
|
||||
|
||||
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
|
||||
public ?string $dns = null;
|
||||
|
||||
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
|
||||
public ?string $netmask = null;
|
||||
|
||||
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
|
||||
public ?string $router = null;
|
||||
|
||||
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
|
||||
public ?string $ntp = null;
|
||||
|
||||
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
|
||||
public ?string $p2pMode = null;
|
||||
|
||||
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
|
||||
public ?int $p2pTime = null;
|
||||
|
||||
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
|
||||
public ?string $mcastIp = null;
|
||||
|
||||
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
|
||||
public ?int $mcastSpeed = null;
|
||||
|
||||
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
|
||||
public ?int $mcastPort = null;
|
||||
|
||||
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
|
||||
public ?string $mcastMode = null;
|
||||
|
||||
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
|
||||
public ?MenuOutput $menu = null;
|
||||
|
||||
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
|
||||
public ?HardwareProfileOutput $hardwareProfile = null;
|
||||
|
||||
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
|
||||
public ?bool $validation = null;
|
||||
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public \DateTime $createdAt;
|
||||
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public ?string $createdBy = null;
|
||||
|
||||
public function __construct(NetworkSettings $networkSettings)
|
||||
{
|
||||
parent::__construct($networkSettings);
|
||||
|
||||
$this->proxy = $networkSettings->getProxy();
|
||||
$this->dns = $networkSettings->getDns();
|
||||
$this->netmask = $networkSettings->getNetmask();
|
||||
$this->router = $networkSettings->getRouter();
|
||||
$this->ntp = $networkSettings->getNtp();
|
||||
$this->p2pMode = $networkSettings->getP2pMode();
|
||||
$this->p2pTime = $networkSettings->getP2pTime();
|
||||
$this->mcastIp = $networkSettings->getMcastIp();
|
||||
$this->mcastSpeed = $networkSettings->getMcastSpeed();
|
||||
$this->mcastPort = $networkSettings->getMcastPort();
|
||||
$this->mcastMode = $networkSettings->getMcastMode();
|
||||
|
||||
if ($networkSettings->getMenu()) {
|
||||
$this->menu = new MenuOutput($networkSettings->getMenu());
|
||||
}
|
||||
|
||||
if ($networkSettings->getHardwareProfile()) {
|
||||
$this->hardwareProfile = new HardwareProfileOutput($networkSettings->getHardwareProfile());
|
||||
}
|
||||
|
||||
$this->validation = $networkSettings->getValidation();
|
||||
$this->createdAt = $networkSettings->getCreatedAt();
|
||||
$this->createdBy = $networkSettings->getCreatedBy();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Entity\OperativeSystem;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
#[Get(shortName: 'OperativeSystem')]
|
||||
final class OperativeSystemOutput extends AbstractOutput
|
||||
{
|
||||
#[Groups(['operative-system:read', 'partition:read'])]
|
||||
public string $name;
|
||||
|
||||
public function __construct(OperativeSystem $operativeSystem)
|
||||
{
|
||||
parent::__construct($operativeSystem);
|
||||
|
||||
$this->name = $operativeSystem->getName();
|
||||
}
|
||||
}
|
|
@ -2,28 +2,93 @@
|
|||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Entity\Client;
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
#[Get(shortName: 'OrganizationalUnit')]
|
||||
final class OrganizationalUnitOutput extends AbstractOutput
|
||||
{
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
#[Groups(['organizational-unit:read', "client:read", "user:read"])]
|
||||
public string $name;
|
||||
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public \DateTime $createAt;
|
||||
public ?string $comments = null;
|
||||
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public ?string $createBy = null;
|
||||
public ?string $description = null;
|
||||
|
||||
public function __construct(OrganizationalUnit $organizationalUnit)
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public ?string $location = null;
|
||||
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public ?bool $projector = null;
|
||||
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public ?bool $board = null;
|
||||
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public ?int $capacity = null;
|
||||
|
||||
#[Groups(['organizational-unit:read', "client:read"])]
|
||||
public string $type;
|
||||
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public ?self $parent = null;
|
||||
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public string $path;
|
||||
|
||||
#[Groups(['organizational-unit:read', "client:read"])]
|
||||
#[ApiProperty(readableLink: true)]
|
||||
public ?NetworkSettingsOutput $networkSettings = null;
|
||||
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public array $children = [];
|
||||
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public array $clients = [];
|
||||
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public \DateTime $createdAt;
|
||||
|
||||
#[Groups(['organizational-unit:read'])]
|
||||
public ?string $createdBy = null;
|
||||
|
||||
public function __construct(OrganizationalUnit $organizationalUnit, array $context = [])
|
||||
{
|
||||
parent::__construct($organizationalUnit);
|
||||
|
||||
$this->name = $organizationalUnit->getName();
|
||||
$this->createAt = $organizationalUnit->getCreatedAt();
|
||||
$this->createBy = $organizationalUnit->getCreatedBy();
|
||||
$this->comments = $organizationalUnit->getComments();
|
||||
$this->description = $organizationalUnit->getDescription();
|
||||
$this->location = $organizationalUnit->getLocation();
|
||||
$this->projector = $organizationalUnit->isProjector();
|
||||
$this->board = $organizationalUnit->isBoard();
|
||||
$this->capacity = $organizationalUnit->getCapacity();
|
||||
$this->type = $organizationalUnit->getType();
|
||||
$this->networkSettings = $organizationalUnit->getNetworkSettings() ? new NetworkSettingsOutput($organizationalUnit->getNetworkSettings()) : null;
|
||||
|
||||
if ($organizationalUnit->getParent()) {
|
||||
$this->parent = new self($organizationalUnit->getParent());
|
||||
}
|
||||
|
||||
if (isset($context['groups']) && in_array('organizational-unit:read', $context['groups'])) {
|
||||
$this->children = $organizationalUnit->getOrganizationalUnits()->map(
|
||||
fn(OrganizationalUnit $organizationalUnit) => new self($organizationalUnit, $context)
|
||||
)->toArray();
|
||||
}
|
||||
|
||||
if (isset($context['groups']) && in_array('organizational-unit:read', $context['groups'])) {
|
||||
$this->clients = $organizationalUnit->getClients()->map(
|
||||
fn(Client $client) => new ClientOutput($client)
|
||||
)->toArray();
|
||||
}
|
||||
|
||||
$this->path = $organizationalUnit->getPath();
|
||||
$this->createdAt = $organizationalUnit->getCreatedAt();
|
||||
$this->createdBy = $organizationalUnit->getCreatedBy();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Entity\Partition;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
#[Get(shortName: 'Partition')]
|
||||
class PartitionOutput extends AbstractOutput
|
||||
{
|
||||
#[Groups(['partition:read', 'client:read'])]
|
||||
public ?int $diskNumber = null;
|
||||
|
||||
#[Groups(['partition:read'])]
|
||||
public ?string $partitionNumber = null;
|
||||
|
||||
#[Groups(['partition:read'])]
|
||||
public ?string $partitionCode = null;
|
||||
|
||||
#[Groups(['partition:read', 'client:read'])]
|
||||
public ?int $size = null;
|
||||
|
||||
#[Groups(['partition:read'])]
|
||||
public ?string $cacheContent = null;
|
||||
|
||||
#[Groups(['partition:read'])]
|
||||
public ?string $filesystem = null;
|
||||
|
||||
#[Groups(['partition:read', 'client:read'])]
|
||||
public ?OperativeSystemOutput $operativeSystem = null;
|
||||
|
||||
#[Groups(['partition:read'])]
|
||||
public ?int $memoryUsage = null;
|
||||
|
||||
public function __construct(Partition $partition)
|
||||
{
|
||||
parent::__construct($partition);
|
||||
|
||||
$this->diskNumber = $partition->getDiskNumber();
|
||||
$this->partitionNumber = $partition->getPartitionNumber();
|
||||
$this->partitionCode = $partition->getPartitionCode();
|
||||
$this->size = $partition->getSize() / 100;
|
||||
$this->cacheContent = $partition->getCacheContent();
|
||||
$this->filesystem = $partition->getFilesystem();
|
||||
if ($partition->getOperativeSystem()) {
|
||||
$this->operativeSystem = new OperativeSystemOutput($partition->getOperativeSystem());
|
||||
}
|
||||
$this->memoryUsage = $partition->getMemoryUsage() / 100;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Entity\Software;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
#[Get(shortName: 'Software')]
|
||||
final class SoftwareOutput extends AbstractOutput
|
||||
{
|
||||
#[Groups(['software:read', 'software-profile:read'])]
|
||||
public string $name;
|
||||
|
||||
#[Groups(['software:read'])]
|
||||
public ?string $description = '';
|
||||
|
||||
#[Groups(['software:read'])]
|
||||
public \DateTime $createdAt;
|
||||
|
||||
#[Groups(['software:read'])]
|
||||
public ?string $createdBy = null;
|
||||
|
||||
public function __construct(Software $software)
|
||||
{
|
||||
parent::__construct($software);
|
||||
|
||||
$this->name = $software->getName();
|
||||
$this->description = $software->getDescription();
|
||||
$this->createdAt = $software->getCreatedAt();
|
||||
$this->createdBy = $software->getCreatedBy();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace App\Dto\Output;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Entity\Software;
|
||||
use App\Entity\SoftwareProfile;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
#[Get(shortName: 'SoftwareProfile')]
|
||||
final class SoftwareProfileOutput extends AbstractOutput
|
||||
{
|
||||
#[Groups(['software-profile:read'])]
|
||||
public ?string $description = '';
|
||||
|
||||
#[Groups(['software-profile:read'])]
|
||||
public ?string $comments = '';
|
||||
|
||||
#[Groups(['software-profile:read'])]
|
||||
public ?OrganizationalUnitOutput $organizationalUnit = null;
|
||||
|
||||
#[Groups(['software-profile:read'])]
|
||||
public ?array $softwareCollection = [];
|
||||
|
||||
#[Groups(['software-profile:read'])]
|
||||
public \DateTime $createdAt;
|
||||
|
||||
#[Groups(['software-profile:read'])]
|
||||
public ?string $createdBy = null;
|
||||
|
||||
public function __construct(SoftwareProfile $softwareProfile)
|
||||
{
|
||||
parent::__construct($softwareProfile);
|
||||
|
||||
$this->description = $softwareProfile->getDescription();
|
||||
$this->comments = $softwareProfile->getComments();
|
||||
if($softwareProfile->getOrganizationalUnit()) {
|
||||
$this->organizationalUnit = new OrganizationalUnitOutput($softwareProfile->getOrganizationalUnit());
|
||||
}
|
||||
|
||||
$this->softwareCollection = $softwareProfile->getSoftwareCollection()->map(
|
||||
fn(Software $hardware) => new SoftwareOutput($hardware)
|
||||
)->toArray();
|
||||
|
||||
$this->createdAt = $softwareProfile->getCreatedAt();
|
||||
$this->createdBy = $softwareProfile->getCreatedBy();
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
#[Get(shortName: 'UserGroup')]
|
||||
final class UserGroupOutput extends AbstractOutput
|
||||
{
|
||||
#[Groups(['user-group:read'])]
|
||||
#[Groups(['user-group:read', 'user:read'])]
|
||||
public string $name;
|
||||
|
||||
#[Groups(['user-group:read'])]
|
||||
|
@ -20,10 +20,10 @@ final class UserGroupOutput extends AbstractOutput
|
|||
public bool $enabled;
|
||||
|
||||
#[Groups(['user-group:read'])]
|
||||
public \DateTime $createAt;
|
||||
public \DateTime $createdAt;
|
||||
|
||||
#[Groups(['user-group:read'])]
|
||||
public ?string $createBy = null;
|
||||
public ?string $createdBy = null;
|
||||
|
||||
public function __construct(UserGroup $userGroup)
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ final class UserGroupOutput extends AbstractOutput
|
|||
$this->name = $userGroup->getName();
|
||||
$this->permissions = $userGroup->getPermissions();
|
||||
$this->enabled = $userGroup->isEnabled();
|
||||
$this->createAt = $userGroup->getCreatedAt();
|
||||
$this->createBy = $userGroup->getCreatedBy();
|
||||
$this->createdAt = $userGroup->getCreatedAt();
|
||||
$this->createdBy = $userGroup->getCreatedBy();
|
||||
}
|
||||
}
|
|
@ -3,7 +3,9 @@
|
|||
namespace App\Dto\Output;
|
||||
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use App\Entity\User;
|
||||
use App\Entity\UserGroup;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
#[Get(shortName: 'User')]
|
||||
|
@ -23,10 +25,10 @@ final class UserOutput extends AbstractOutput
|
|||
public array $userGroups;
|
||||
|
||||
#[Groups(['user:read'])]
|
||||
public \DateTime $createAt;
|
||||
public \DateTime $createdAt;
|
||||
|
||||
#[Groups(['user:read'])]
|
||||
public ?string $createBy = null;
|
||||
public ?string $createdBy = null;
|
||||
|
||||
public function __construct(User $user)
|
||||
{
|
||||
|
@ -35,9 +37,16 @@ final class UserOutput extends AbstractOutput
|
|||
$this->username = $user->getUsername();
|
||||
$this->roles = $user->getRoles();
|
||||
$this->enabled = $user->isEnabled();
|
||||
$this->userGroups = $user->getUserGroups()->toArray();
|
||||
$this->allowedOrganizationalUnits = $user->getAllowedOrganizationalUnits()->toArray();
|
||||
$this->createAt = $user->getCreatedAt();
|
||||
$this->createBy = $user->getCreatedBy();
|
||||
|
||||
$this->userGroups = $user->getUserGroups()->map(
|
||||
fn(UserGroup $userGroup) => new UserGroupOutput($userGroup)
|
||||
)->toArray();
|
||||
|
||||
$this->allowedOrganizationalUnits = $user->getAllowedOrganizationalUnits()->map(
|
||||
fn(OrganizationalUnit $organizationalUnit) => new OrganizationalUnitOutput($organizationalUnit)
|
||||
)->toArray();
|
||||
|
||||
$this->createdAt = $user->getCreatedAt();
|
||||
$this->createdBy = $user->getCreatedBy();
|
||||
}
|
||||
}
|
|
@ -3,13 +3,19 @@
|
|||
namespace App\Entity;
|
||||
|
||||
use App\Repository\ClientRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ClientRepository::class)]
|
||||
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_IP', fields: ['ip'])]
|
||||
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_MAC', fields: ['mac'])]
|
||||
#[UniqueEntity(fields: ['ip'], message: 'This IP address is already in use.')]
|
||||
#[UniqueEntity(fields: ['mac'], message: 'This MAC address is already in use.')]
|
||||
class Client extends AbstractEntity
|
||||
{
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $name = null;
|
||||
use NameableTrait;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $serialNumber = null;
|
||||
|
@ -30,19 +36,28 @@ class Client extends AbstractEntity
|
|||
private ?string $status = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'clients')]
|
||||
#[ORM\JoinColumn( onDelete: 'CASCADE')]
|
||||
private ?OrganizationalUnit $organizationalUnit = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Partition>
|
||||
*/
|
||||
#[ORM\OneToMany(mappedBy: 'client', targetEntity: Partition::class)]
|
||||
private Collection $partitions;
|
||||
|
||||
public function getName(): ?string
|
||||
#[ORM\ManyToOne]
|
||||
private ?Menu $menu = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
private ?HardwareProfile $hardwareProfile = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $validation = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName(?string $name): static
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
parent::__construct();
|
||||
$this->partitions = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getSerialNumber(): ?string
|
||||
|
@ -74,7 +89,7 @@ class Client extends AbstractEntity
|
|||
return $this->netDriver;
|
||||
}
|
||||
|
||||
public function setNetDriver(string $netDriver): static
|
||||
public function setNetDriver(?string $netDriver): static
|
||||
{
|
||||
$this->netDriver = $netDriver;
|
||||
|
||||
|
@ -128,4 +143,70 @@ class Client extends AbstractEntity
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Partition>
|
||||
*/
|
||||
public function getPartitions(): Collection
|
||||
{
|
||||
return $this->partitions;
|
||||
}
|
||||
|
||||
public function addPartition(Partition $partition): static
|
||||
{
|
||||
if (!$this->partitions->contains($partition)) {
|
||||
$this->partitions->add($partition);
|
||||
$partition->setClient($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removePartition(Partition $partition): static
|
||||
{
|
||||
if ($this->partitions->removeElement($partition)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($partition->getClient() === $this) {
|
||||
$partition->setClient(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMenu(): ?Menu
|
||||
{
|
||||
return $this->menu;
|
||||
}
|
||||
|
||||
public function setMenu(?Menu $menu): static
|
||||
{
|
||||
$this->menu = $menu;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getHardwareProfile(): ?HardwareProfile
|
||||
{
|
||||
return $this->hardwareProfile;
|
||||
}
|
||||
|
||||
public function setHardwareProfile(?HardwareProfile $hardwareProfile): static
|
||||
{
|
||||
$this->hardwareProfile = $hardwareProfile;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getValidation(): ?bool
|
||||
{
|
||||
return $this->validation;
|
||||
}
|
||||
|
||||
public function setValidation(?bool $validation): static
|
||||
{
|
||||
$this->validation = $validation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\HardwareRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: HardwareRepository::class)]
|
||||
class Hardware extends AbstractEntity
|
||||
{
|
||||
use NameableTrait;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $description = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, HardwareProfile>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: HardwareProfile::class, mappedBy: 'hardwareCollection')]
|
||||
private Collection $hardwareProfiles;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
private ?HardwareType $type = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__Construct();
|
||||
|
||||
$this->hardwareProfiles = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): static
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, HardwareProfile>
|
||||
*/
|
||||
public function getHardwareProfiles(): Collection
|
||||
{
|
||||
return $this->hardwareProfiles;
|
||||
}
|
||||
|
||||
public function addHardwareProfile(HardwareProfile $hardwareProfile): static
|
||||
{
|
||||
if (!$this->hardwareProfiles->contains($hardwareProfile)) {
|
||||
$this->hardwareProfiles->add($hardwareProfile);
|
||||
$hardwareProfile->addHardwareCollection($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeHardwareProfile(HardwareProfile $hardwareProfile): static
|
||||
{
|
||||
if ($this->hardwareProfiles->removeElement($hardwareProfile)) {
|
||||
$hardwareProfile->removeHardwareCollection($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getType(): ?HardwareType
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function setType(?HardwareType $type): static
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,137 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\HardwareProfileRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: HardwareProfileRepository::class)]
|
||||
class HardwareProfile extends AbstractEntity
|
||||
{
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $comments = null;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: OrganizationalUnit::class)]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?OrganizationalUnit $organizationalUnit = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Hardware>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: Hardware::class, inversedBy: 'hardwareProfiles')]
|
||||
private Collection $hardwareCollection;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Client>
|
||||
*/
|
||||
#[ORM\OneToMany(mappedBy: 'hardwareProfile', targetEntity: Client::class)]
|
||||
private Collection $clients;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->hardwareCollection = new ArrayCollection();
|
||||
$this->clients = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): static
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getComments(): ?string
|
||||
{
|
||||
return $this->comments;
|
||||
}
|
||||
|
||||
public function setComments(?string $comments): static
|
||||
{
|
||||
$this->comments = $comments;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOrganizationalUnit(): ?OrganizationalUnit
|
||||
{
|
||||
return $this->organizationalUnit;
|
||||
}
|
||||
|
||||
public function setOrganizationalUnit(?OrganizationalUnit $organizationalUnit): static
|
||||
{
|
||||
$this->organizationalUnit = $organizationalUnit;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Hardware>
|
||||
*/
|
||||
public function getHardwareCollection(): Collection
|
||||
{
|
||||
return $this->hardwareCollection;
|
||||
}
|
||||
|
||||
public function addHardwareCollection(Hardware $hardwareCollection): static
|
||||
{
|
||||
if (!$this->hardwareCollection->contains($hardwareCollection)) {
|
||||
$this->hardwareCollection->add($hardwareCollection);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeHardwareCollection(Hardware $hardwareCollection): static
|
||||
{
|
||||
$this->hardwareCollection->removeElement($hardwareCollection);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Client>
|
||||
*/
|
||||
public function getClients(): Collection
|
||||
{
|
||||
return $this->clients;
|
||||
}
|
||||
|
||||
public function addClient(Client $client): static
|
||||
{
|
||||
if (!$this->clients->contains($client)) {
|
||||
$this->clients->add($client);
|
||||
$client->setHardwareProfile($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeClient(Client $client): static
|
||||
{
|
||||
if ($this->clients->removeElement($client)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($client->getHardwareProfile() === $this) {
|
||||
$client->setHardwareProfile(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\HardwareTypeRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: HardwareTypeRepository::class)]
|
||||
class HardwareType extends AbstractEntity
|
||||
{
|
||||
use NameableTrait;
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\ImageRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ImageRepository::class)]
|
||||
class Image extends AbstractEntity
|
||||
{
|
||||
use NameableTrait;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $comments = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $path = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $type = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $revision = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $info = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $size = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Client $client = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?SoftwareProfile $softwareProfile = null;
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): static
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getComments(): ?string
|
||||
{
|
||||
return $this->comments;
|
||||
}
|
||||
|
||||
public function setComments(?string $comments): static
|
||||
{
|
||||
$this->comments = $comments;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPath(): ?string
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
public function setPath(string $path): static
|
||||
{
|
||||
$this->path = $path;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getType(): ?string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function setType(string $type): static
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRevision(): ?string
|
||||
{
|
||||
return $this->revision;
|
||||
}
|
||||
|
||||
public function setRevision(?string $revision): static
|
||||
{
|
||||
$this->revision = $revision;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getInfo(): ?string
|
||||
{
|
||||
return $this->info;
|
||||
}
|
||||
|
||||
public function setInfo(?string $info): static
|
||||
{
|
||||
$this->info = $info;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSize(): ?int
|
||||
{
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
public function setSize(int $size): static
|
||||
{
|
||||
$this->size = $size;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getClient(): ?Client
|
||||
{
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
public function setClient(?Client $client): static
|
||||
{
|
||||
$this->client = $client;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSoftwareProfile(): ?SoftwareProfile
|
||||
{
|
||||
return $this->softwareProfile;
|
||||
}
|
||||
|
||||
public function setSoftwareProfile(?SoftwareProfile $softwareProfile): static
|
||||
{
|
||||
$this->softwareProfile = $softwareProfile;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\MenuRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: MenuRepository::class)]
|
||||
class Menu extends AbstractEntity
|
||||
{
|
||||
use NameableTrait;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $title = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $resolution = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $comments = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $publicUrl = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $privateUrl = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Client>
|
||||
*/
|
||||
#[ORM\OneToMany(mappedBy: 'menu', targetEntity: Client::class)]
|
||||
private Collection $clients;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->clients = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getTitle(): ?string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setTitle(string $title): static
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getResolution(): ?string
|
||||
{
|
||||
return $this->resolution;
|
||||
}
|
||||
|
||||
public function setResolution(string $resolution): static
|
||||
{
|
||||
$this->resolution = $resolution;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getComments(): ?string
|
||||
{
|
||||
return $this->comments;
|
||||
}
|
||||
|
||||
public function setComments(?string $comments): static
|
||||
{
|
||||
$this->comments = $comments;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPublicUrl(): ?string
|
||||
{
|
||||
return $this->publicUrl;
|
||||
}
|
||||
|
||||
public function setPublicUrl(?string $publicUrl): static
|
||||
{
|
||||
$this->publicUrl = $publicUrl;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrivateUrl(): ?string
|
||||
{
|
||||
return $this->privateUrl;
|
||||
}
|
||||
|
||||
public function setPrivateUrl(?string $privateUrl): static
|
||||
{
|
||||
$this->privateUrl = $privateUrl;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeClient(Client $client): static
|
||||
{
|
||||
if ($this->clients->removeElement($client)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($client->getMenu() === $this) {
|
||||
$client->setMenu(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -1,753 +0,0 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
|
@ -1,663 +0,0 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
|
@ -34,7 +34,7 @@ class NetworkSettings extends AbstractEntity
|
|||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $mcastIp = null;
|
||||
|
||||
#[ORM\Column]
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?int $mcastSpeed = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
|
@ -46,9 +46,20 @@ class NetworkSettings extends AbstractEntity
|
|||
/**
|
||||
* @var Collection<int, OrganizationalUnit>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: OrganizationalUnit::class, mappedBy: 'networkSettings')]
|
||||
#[ORM\OneToMany(mappedBy: 'networkSettings', targetEntity: OrganizationalUnit::class)]
|
||||
private Collection $organizationalUnits;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: Menu::class)]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
private ?Menu $menu = null;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: HardwareProfile::class)]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
private ?HardwareProfile $hardwareProfile = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $validation = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
@ -161,7 +172,7 @@ class NetworkSettings extends AbstractEntity
|
|||
return $this->mcastSpeed;
|
||||
}
|
||||
|
||||
public function setMcastSpeed(int $mcastSpeed): static
|
||||
public function setMcastSpeed(?int $mcastSpeed): static
|
||||
{
|
||||
$this->mcastSpeed = $mcastSpeed;
|
||||
|
||||
|
@ -221,4 +232,40 @@ class NetworkSettings extends AbstractEntity
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMenu(): ?Menu
|
||||
{
|
||||
return $this->menu;
|
||||
}
|
||||
|
||||
public function setMenu(?Menu $menu): static
|
||||
{
|
||||
$this->menu = $menu;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getHardwareProfile(): ?HardwareProfile
|
||||
{
|
||||
return $this->hardwareProfile;
|
||||
}
|
||||
|
||||
public function setHardwareProfile(?HardwareProfile $hardwareProfile): static
|
||||
{
|
||||
$this->hardwareProfile = $hardwareProfile;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getValidation(): ?bool
|
||||
{
|
||||
return $this->validation;
|
||||
}
|
||||
|
||||
public function setValidation(?bool $validation): static
|
||||
{
|
||||
$this->validation = $validation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\OperativeSystemRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: OperativeSystemRepository::class)]
|
||||
class OperativeSystem extends AbstractEntity
|
||||
{
|
||||
use NameableTrait;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Partition>
|
||||
*/
|
||||
#[ORM\OneToMany(mappedBy: 'operativeSystem', targetEntity: Partition::class)]
|
||||
private Collection $partitions;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->partitions = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Partition>
|
||||
*/
|
||||
public function getPartitions(): Collection
|
||||
{
|
||||
return $this->partitions;
|
||||
}
|
||||
|
||||
public function addPartition(Partition $partition): static
|
||||
{
|
||||
if (!$this->partitions->contains($partition)) {
|
||||
$this->partitions->add($partition);
|
||||
$partition->setOperativeSystem($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removePartition(Partition $partition): static
|
||||
{
|
||||
if ($this->partitions->removeElement($partition)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($partition->getOperativeSystem() === $this) {
|
||||
$partition->setOperativeSystem(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\OperativeSystemTypeRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: OperativeSystemTypeRepository::class)]
|
||||
class OperativeSystemType extends AbstractEntity
|
||||
{
|
||||
use NameableTrait;
|
||||
}
|
|
@ -7,9 +7,12 @@ use Doctrine\Common\Collections\ArrayCollection;
|
|||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Gedmo\Tree\Entity\Repository\MaterializedPathRepository;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
#[Gedmo\Tree(type: 'materializedPath')]
|
||||
#[ORM\Entity(repositoryClass: MaterializedPathRepository::class)]
|
||||
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_NAME', columns: ['name', 'parent_id'])]
|
||||
#[UniqueEntity(fields: ['name', 'parent'], message: 'This organizational unit already exists.')]
|
||||
class OrganizationalUnit extends AbstractEntity
|
||||
{
|
||||
use NameableTrait;
|
||||
|
@ -44,7 +47,8 @@ class OrganizationalUnit extends AbstractEntity
|
|||
#[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class)]
|
||||
private Collection $organizationalUnits;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'organizationalUnits')]
|
||||
#[ORM\ManyToOne(targetEntity: NetworkSettings::class, inversedBy: 'organizationalUnits', cascade: ['persist'])]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
private ?NetworkSettings $networkSettings = null;
|
||||
|
||||
/**
|
||||
|
@ -59,12 +63,34 @@ class OrganizationalUnit extends AbstractEntity
|
|||
#[ORM\OneToMany(mappedBy: 'organizationalUnit', targetEntity: Client::class)]
|
||||
private Collection $clients;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $type = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $location = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $projector = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $board = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $capacity = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, SoftwareProfile>
|
||||
*/
|
||||
#[ORM\OneToMany(mappedBy: 'organizationalUnit', targetEntity: SoftwareProfile::class)]
|
||||
private Collection $softwareProfiles;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->organizationalUnits = new ArrayCollection();
|
||||
$this->users = new ArrayCollection();
|
||||
$this->clients = new ArrayCollection();
|
||||
$this->softwareProfiles = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
|
@ -236,4 +262,110 @@ class OrganizationalUnit extends AbstractEntity
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getType(): ?string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function setType(string $type): static
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLocation(): ?string
|
||||
{
|
||||
return $this->location;
|
||||
}
|
||||
|
||||
public function setLocation(?string $location): static
|
||||
{
|
||||
$this->location = $location;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isProjector(): ?bool
|
||||
{
|
||||
return $this->projector;
|
||||
}
|
||||
|
||||
public function setProjector(?bool $projector): static
|
||||
{
|
||||
$this->projector = $projector;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isBoard(): ?bool
|
||||
{
|
||||
return $this->board;
|
||||
}
|
||||
|
||||
public function setBoard(?bool $board): static
|
||||
{
|
||||
$this->board = $board;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCapacity(): ?int
|
||||
{
|
||||
return $this->capacity;
|
||||
}
|
||||
|
||||
public function setCapacity(?int $capacity): static
|
||||
{
|
||||
$this->capacity = $capacity;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function updateNetworkSettingsRecursively(?NetworkSettings $networkSettings): void
|
||||
{
|
||||
$this->setNetworkSettings($networkSettings);
|
||||
|
||||
/** @var Client $client */
|
||||
foreach ($this->getClients() as $client) {
|
||||
$client->setMenu($networkSettings->getMenu());
|
||||
$client->setHardwareProfile($networkSettings->getHardwareProfile());
|
||||
$client->setValidation($networkSettings->getValidation());
|
||||
}
|
||||
|
||||
foreach ($this->getOrganizationalUnits() as $childUnit) {
|
||||
$childUnit->updateNetworkSettingsRecursively($networkSettings);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, SoftwareProfile>
|
||||
*/
|
||||
public function getSoftwareProfiles(): Collection
|
||||
{
|
||||
return $this->softwareProfiles;
|
||||
}
|
||||
|
||||
public function addSoftwareProfile(SoftwareProfile $softwareProfile): static
|
||||
{
|
||||
if (!$this->softwareProfiles->contains($softwareProfile)) {
|
||||
$this->softwareProfiles->add($softwareProfile);
|
||||
$softwareProfile->setOrganizationalUnit($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeSoftwareProfile(SoftwareProfile $softwareProfile): static
|
||||
{
|
||||
if ($this->softwareProfiles->removeElement($softwareProfile)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($softwareProfile->getOrganizationalUnit() === $this) {
|
||||
$softwareProfile->setOrganizationalUnit(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\PartitionRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: PartitionRepository::class)]
|
||||
#[ORM\Table(name: '`partition`')]
|
||||
class Partition extends AbstractEntity
|
||||
{
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $diskNumber = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $partitionNumber = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $partitionCode = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $size = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $cacheContent = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $filesystem = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'partitions')]
|
||||
#[ORM\JoinColumn( onDelete: 'CASCADE')]
|
||||
private ?Client $client = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $memoryUsage = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'partitions')]
|
||||
private ?OperativeSystem $operativeSystem = null;
|
||||
|
||||
public function getDiskNumber(): ?int
|
||||
{
|
||||
return $this->diskNumber;
|
||||
}
|
||||
|
||||
public function setDiskNumber(?int $diskNumber): static
|
||||
{
|
||||
$this->diskNumber = $diskNumber;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPartitionNumber(): ?int
|
||||
{
|
||||
return $this->partitionNumber;
|
||||
}
|
||||
|
||||
public function setPartitionNumber(?int $partitionNumber): static
|
||||
{
|
||||
$this->partitionNumber = $partitionNumber;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPartitionCode(): ?string
|
||||
{
|
||||
return $this->partitionCode;
|
||||
}
|
||||
|
||||
public function setPartitionCode(?string $partitionCode): static
|
||||
{
|
||||
$this->partitionCode = $partitionCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSize(): ?int
|
||||
{
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
public function setSize(int $size): static
|
||||
{
|
||||
$this->size = $size;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCacheContent(): ?string
|
||||
{
|
||||
return $this->cacheContent;
|
||||
}
|
||||
|
||||
public function setCacheContent(?string $cacheContent): static
|
||||
{
|
||||
$this->cacheContent = $cacheContent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFilesystem(): ?string
|
||||
{
|
||||
return $this->filesystem;
|
||||
}
|
||||
|
||||
public function setFilesystem(?string $filesystem): static
|
||||
{
|
||||
$this->filesystem = $filesystem;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getClient(): ?Client
|
||||
{
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
public function setClient(?Client $client): static
|
||||
{
|
||||
$this->client = $client;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMemoryUsage(): ?int
|
||||
{
|
||||
return $this->memoryUsage;
|
||||
}
|
||||
|
||||
public function setMemoryUsage(int $memoryUsage): static
|
||||
{
|
||||
$this->memoryUsage = $memoryUsage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOperativeSystem(): ?OperativeSystem
|
||||
{
|
||||
return $this->operativeSystem;
|
||||
}
|
||||
|
||||
public function setOperativeSystem(?OperativeSystem $operativeSystem): static
|
||||
{
|
||||
$this->operativeSystem = $operativeSystem;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\SoftwareRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: SoftwareRepository::class)]
|
||||
class Software extends AbstractEntity
|
||||
{
|
||||
use NameableTrait;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $description = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, SoftwareProfile>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: SoftwareProfile::class, mappedBy: 'softwareCollection')]
|
||||
private Collection $softwareProfiles;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->softwareProfiles = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): static
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, SoftwareProfile>
|
||||
*/
|
||||
public function getSoftwareProfiles(): Collection
|
||||
{
|
||||
return $this->softwareProfiles;
|
||||
}
|
||||
|
||||
public function addSoftwareProfile(SoftwareProfile $softwareProfile): static
|
||||
{
|
||||
if (!$this->softwareProfiles->contains($softwareProfile)) {
|
||||
$this->softwareProfiles->add($softwareProfile);
|
||||
$softwareProfile->addSoftwareCollection($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeSoftwareProfile(SoftwareProfile $softwareProfile): static
|
||||
{
|
||||
if ($this->softwareProfiles->removeElement($softwareProfile)) {
|
||||
$softwareProfile->removeSoftwareCollection($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\SoftwareProfileRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: SoftwareProfileRepository::class)]
|
||||
class SoftwareProfile extends AbstractEntity
|
||||
{
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $comments = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'softwareProfiles')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?OrganizationalUnit $organizationalUnit = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Software>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: Software::class, inversedBy: 'softwareProfiles')]
|
||||
private Collection $softwareCollection;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->softwareCollection = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): static
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getComments(): ?string
|
||||
{
|
||||
return $this->comments;
|
||||
}
|
||||
|
||||
public function setComments(?string $comments): static
|
||||
{
|
||||
$this->comments = $comments;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOrganizationalUnit(): ?OrganizationalUnit
|
||||
{
|
||||
return $this->organizationalUnit;
|
||||
}
|
||||
|
||||
public function setOrganizationalUnit(?OrganizationalUnit $organizationalUnit): static
|
||||
{
|
||||
$this->organizationalUnit = $organizationalUnit;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Software>
|
||||
*/
|
||||
public function getSoftwareCollection(): Collection
|
||||
{
|
||||
return $this->softwareCollection;
|
||||
}
|
||||
|
||||
public function addSoftwareCollection(Software $softwareCollection): static
|
||||
{
|
||||
if (!$this->softwareCollection->contains($softwareCollection)) {
|
||||
$this->softwareCollection->add($softwareCollection);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeSoftwareCollection(Software $softwareCollection): static
|
||||
{
|
||||
$this->softwareCollection->removeElement($softwareCollection);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -17,8 +17,8 @@ class User extends AbstractEntity implements UserInterface, PasswordAuthenticate
|
|||
{
|
||||
use ToggleableTrait;
|
||||
|
||||
const ROLE_SUPER_ADMIN = 'ROLE_SUPER_ADMIN';
|
||||
const ROLE_USER = 'ROLE_USER';
|
||||
const string ROLE_SUPER_ADMIN = 'ROLE_SUPER_ADMIN';
|
||||
const string ROLE_USER = 'ROLE_USER';
|
||||
|
||||
#[ORM\Column(length: 180)]
|
||||
private ?string $username = null;
|
||||
|
@ -38,7 +38,7 @@ class User extends AbstractEntity implements UserInterface, PasswordAuthenticate
|
|||
/**
|
||||
* @var Collection<int, UserGroup>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: UserGroup::class, mappedBy: 'users')]
|
||||
#[ORM\ManyToMany(targetEntity: UserGroup::class, inversedBy: 'users')]
|
||||
private Collection $userGroups;
|
||||
|
||||
/**
|
||||
|
@ -160,7 +160,7 @@ class User extends AbstractEntity implements UserInterface, PasswordAuthenticate
|
|||
{
|
||||
if (!$this->userGroups->contains($userGroup)) {
|
||||
$this->userGroups->add($userGroup);
|
||||
$userGroup->addUser($this);
|
||||
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
|
|
@ -23,7 +23,7 @@ class UserGroup extends AbstractEntity
|
|||
/**
|
||||
* @var Collection<int, User>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: User::class, inversedBy: 'userGroups')]
|
||||
#[ORM\ManyToMany(targetEntity: User::class, mappedBy: 'userGroups')]
|
||||
private Collection $users;
|
||||
|
||||
public function __construct()
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace App\Factory;
|
||||
|
||||
use App\Entity\Client;
|
||||
use Zenstruck\Foundry\ModelFactory;
|
||||
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;
|
||||
|
||||
/**
|
||||
* @extends ModelFactory<Client>
|
||||
*/
|
||||
final class ClientFactory extends ModelFactory
|
||||
{
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
|
||||
*
|
||||
* @todo inject services if required
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
||||
*
|
||||
* @todo add your default values here
|
||||
*/
|
||||
protected function getDefaults(): array
|
||||
{
|
||||
return [
|
||||
'createdAt' => self::faker()->dateTime(),
|
||||
'name' => self::faker()->text(255),
|
||||
'updatedAt' => self::faker()->dateTime(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||||
*/
|
||||
protected function initialize(): self
|
||||
{
|
||||
return $this
|
||||
// ->afterInstantiate(function(Client $client): void {})
|
||||
;
|
||||
}
|
||||
|
||||
protected static function getClass(): string
|
||||
{
|
||||
return Client::class;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
namespace App\Factory;
|
||||
|
||||
use App\Entity\Hardware;
|
||||
use App\Repository\HardwareRepository;
|
||||
use Zenstruck\Foundry\ModelFactory;
|
||||
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;
|
||||
use Zenstruck\Foundry\Persistence\Proxy;
|
||||
use Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator;
|
||||
|
||||
/**
|
||||
* @extends PersistentProxyObjectFactory<Hardware>
|
||||
*/
|
||||
final class HardwareFactory extends ModelFactory
|
||||
{
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
|
||||
*
|
||||
* @todo inject services if required
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public static function class(): string
|
||||
{
|
||||
return Hardware::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
||||
*
|
||||
* @todo add your default values here
|
||||
*/
|
||||
protected function getDefaults(): array
|
||||
{
|
||||
return [
|
||||
'createdAt' => self::faker()->dateTime(),
|
||||
'name' => self::faker()->text(255),
|
||||
'updatedAt' => self::faker()->dateTime(),
|
||||
'type' => HardwareTypeFactory::new()
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||||
*/
|
||||
protected function initialize(): self
|
||||
{
|
||||
return $this
|
||||
// ->afterInstantiate(function(Hardware $hardware): void {})
|
||||
;
|
||||
}
|
||||
|
||||
protected static function getClass(): string
|
||||
{
|
||||
return Hardware::class;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace App\Factory;
|
||||
|
||||
use App\Entity\HardwareProfile;
|
||||
use App\Model\OrganizationalUnitTypes;
|
||||
use Zenstruck\Foundry\ModelFactory;
|
||||
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;
|
||||
|
||||
/**
|
||||
* @extends ModelFactory<HardwareProfile>
|
||||
*/
|
||||
final class HardwareProfileFactory extends ModelFactory
|
||||
{
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
|
||||
*
|
||||
* @todo inject services if required
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public static function class(): string
|
||||
{
|
||||
return HardwareProfile::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
||||
*
|
||||
* @todo add your default values here
|
||||
*/
|
||||
protected function getDefaults(): array
|
||||
{
|
||||
return [
|
||||
'createdAt' => self::faker()->dateTime(),
|
||||
'updatedAt' => self::faker()->dateTime(),
|
||||
'description' => self::faker()->text(255),
|
||||
'organizationalUnit' => OrganizationalUnitFactory::createOne(['type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT])->_save(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||||
*/
|
||||
protected function initialize(): self
|
||||
{
|
||||
return $this
|
||||
// ->afterInstantiate(function(HardwareProfile $hardwareProfile): void {})
|
||||
;
|
||||
}
|
||||
|
||||
protected static function getClass(): string
|
||||
{
|
||||
return HardwareProfile::class;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace App\Factory;
|
||||
|
||||
use App\Entity\HardwareType;
|
||||
use App\Repository\HardwareTypeRepository;
|
||||
use Zenstruck\Foundry\ModelFactory;
|
||||
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;
|
||||
use Zenstruck\Foundry\Persistence\Proxy;
|
||||
use Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator;
|
||||
|
||||
/**
|
||||
* @extends PersistentProxyObjectFactory<HardwareType>
|
||||
*/
|
||||
final class HardwareTypeFactory extends ModelFactory
|
||||
{
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
|
||||
*
|
||||
* @todo inject services if required
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
||||
*
|
||||
* @todo add your default values here
|
||||
*/
|
||||
protected function getDefaults(): array
|
||||
{
|
||||
return [
|
||||
'createdAt' => self::faker()->dateTime(),
|
||||
'name' => self::faker()->text(255),
|
||||
'updatedAt' => self::faker()->dateTime(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||||
*/
|
||||
protected function initialize(): self
|
||||
{
|
||||
return $this
|
||||
// ->afterInstantiate(function(HardwareType $hardwareType): void {})
|
||||
;
|
||||
}
|
||||
|
||||
protected static function getClass(): string
|
||||
{
|
||||
return HardwareType::class;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace App\Factory;
|
||||
|
||||
use App\Entity\Image;
|
||||
use App\Repository\ImageRepository;
|
||||
use Zenstruck\Foundry\ModelFactory;
|
||||
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;
|
||||
use Zenstruck\Foundry\Persistence\Proxy;
|
||||
use Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator;
|
||||
|
||||
/**
|
||||
* @extends PersistentProxyObjectFactory<Image>
|
||||
*/
|
||||
final class ImageFactory extends ModelFactory
|
||||
{
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
|
||||
*
|
||||
* @todo inject services if required
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
||||
*
|
||||
* @todo add your default values here
|
||||
*/
|
||||
protected function getDefaults(): array
|
||||
{
|
||||
return [
|
||||
'client' => ClientFactory::new(),
|
||||
'createdAt' => self::faker()->dateTime(),
|
||||
'name' => self::faker()->text(255),
|
||||
'path' => self::faker()->text(255),
|
||||
'size' => self::faker()->randomNumber(),
|
||||
'softwareProfile' => SoftwareProfileFactory::new(),
|
||||
'type' => self::faker()->text(255),
|
||||
'updatedAt' => self::faker()->dateTime(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||||
*/
|
||||
protected function initialize(): self
|
||||
{
|
||||
return $this
|
||||
// ->afterInstantiate(function(Image $image): void {})
|
||||
;
|
||||
}
|
||||
|
||||
protected static function getClass(): string
|
||||
{
|
||||
return Image::class;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace App\Factory;
|
||||
|
||||
use App\Entity\Menu;
|
||||
use App\Repository\MenuRepository;
|
||||
use Zenstruck\Foundry\ModelFactory;
|
||||
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;
|
||||
use Zenstruck\Foundry\Persistence\Proxy;
|
||||
use Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator;
|
||||
|
||||
/**
|
||||
* @extends PersistentProxyObjectFactory<Menu>
|
||||
*/
|
||||
final class MenuFactory extends ModelFactory
|
||||
{
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
|
||||
*
|
||||
* @todo inject services if required
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
||||
*/
|
||||
protected function getDefaults(): array
|
||||
{
|
||||
return [
|
||||
'createdAt' => self::faker()->dateTime(),
|
||||
'name' => self::faker()->text(255),
|
||||
'resolution' => self::faker()->text(255),
|
||||
'title' => self::faker()->text(255),
|
||||
'updatedAt' => self::faker()->dateTime(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||||
*/
|
||||
protected function initialize(): self
|
||||
{
|
||||
return $this
|
||||
// ->afterInstantiate(function(Menu $menu): void {})
|
||||
;
|
||||
}
|
||||
|
||||
protected static function getClass(): string
|
||||
{
|
||||
return Menu::class;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace App\Factory;
|
||||
|
||||
use App\Entity\OperativeSystem;
|
||||
use App\Repository\OperativeSystemRepository;
|
||||
use Zenstruck\Foundry\ModelFactory;
|
||||
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;
|
||||
use Zenstruck\Foundry\Persistence\Proxy;
|
||||
use Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator;
|
||||
|
||||
/**
|
||||
* @extends PersistentProxyObjectFactory<OperativeSystem>
|
||||
*/
|
||||
final class OperativeSystemFactory extends ModelFactory
|
||||
{
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public static function class(): string
|
||||
{
|
||||
return OperativeSystem::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
||||
*
|
||||
* @todo add your default values here
|
||||
*/
|
||||
protected function getDefaults(): array
|
||||
{
|
||||
return [
|
||||
'createdAt' => self::faker()->dateTime(),
|
||||
'name' => self::faker()->text(255),
|
||||
'updatedAt' => self::faker()->dateTime(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||||
*/
|
||||
protected function initialize(): self
|
||||
{
|
||||
return $this
|
||||
// ->afterInstantiate(function(OperativeSystem $operativeSystem): void {})
|
||||
;
|
||||
}
|
||||
|
||||
protected static function getClass(): string
|
||||
{
|
||||
return OperativeSystem::class;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue