diff --git a/.env b/.env index 48bdf9b..2d1c753 100644 --- a/.env +++ b/.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 ### diff --git a/README.md b/README.md index 4aeaad1..f9dd15d 100644 --- a/README.md +++ b/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 +``` + +![img.png](swagger-assets/img_bbdd.png) + +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) diff --git a/composer.lock b/composer.lock index 2b0b43f..f49d68c 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "api-platform/core", - "version": "v3.3.3", + "version": "v3.3.5", "source": { "type": "git", "url": "https://github.com/api-platform/core.git", - "reference": "59dca65e4f9aa2be6fd85fa944482a7d73eb5fc2" + "reference": "b5a93fb0bb855273aabb0807505ba61b68813246" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/api-platform/core/zipball/59dca65e4f9aa2be6fd85fa944482a7d73eb5fc2", - "reference": "59dca65e4f9aa2be6fd85fa944482a7d73eb5fc2", + "url": "https://api.github.com/repos/api-platform/core/zipball/b5a93fb0bb855273aabb0807505ba61b68813246", + "reference": "b5a93fb0bb855273aabb0807505ba61b68813246", "shasum": "" }, "require": { @@ -190,9 +190,9 @@ ], "support": { "issues": "https://github.com/api-platform/core/issues", - "source": "https://github.com/api-platform/core/tree/v3.3.3" + "source": "https://github.com/api-platform/core/tree/v3.3.5" }, - "time": "2024-05-10T11:16:59+00:00" + "time": "2024-05-29T05:48:47+00:00" }, { "name": "behat/transliterator", @@ -575,16 +575,16 @@ }, { "name": "doctrine/dbal", - "version": "3.8.4", + "version": "3.8.5", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "b05e48a745f722801f55408d0dbd8003b403dbbd" + "reference": "0e3536ba088a749985c8801105b6b3ac6c1280b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/b05e48a745f722801f55408d0dbd8003b403dbbd", - "reference": "b05e48a745f722801f55408d0dbd8003b403dbbd", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/0e3536ba088a749985c8801105b6b3ac6c1280b6", + "reference": "0e3536ba088a749985c8801105b6b3ac6c1280b6", "shasum": "" }, "require": { @@ -600,12 +600,12 @@ "doctrine/coding-standard": "12.0.0", "fig/log-test": "^1", "jetbrains/phpstorm-stubs": "2023.1", - "phpstan/phpstan": "1.10.58", - "phpstan/phpstan-strict-rules": "^1.5", - "phpunit/phpunit": "9.6.16", + "phpstan/phpstan": "1.11.1", + "phpstan/phpstan-strict-rules": "^1.6", + "phpunit/phpunit": "9.6.19", "psalm/plugin-phpunit": "0.18.4", "slevomat/coding-standard": "8.13.1", - "squizlabs/php_codesniffer": "3.9.0", + "squizlabs/php_codesniffer": "3.9.2", "symfony/cache": "^5.4|^6.0|^7.0", "symfony/console": "^4.4|^5.4|^6.0|^7.0", "vimeo/psalm": "4.30.0" @@ -668,7 +668,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.8.4" + "source": "https://github.com/doctrine/dbal/tree/3.8.5" }, "funding": [ { @@ -684,7 +684,7 @@ "type": "tidelift" } ], - "time": "2024-04-25T07:04:44+00:00" + "time": "2024-06-08T17:49:56+00:00" }, { "name": "doctrine/deprecations", @@ -2329,16 +2329,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.29.0", + "version": "1.29.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc" + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/536889f2b340489d328f5ffb7b02bb6b183ddedc", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fcaefacf2d5c417e928405b71b400d4ce10daaf4", + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4", "shasum": "" }, "require": { @@ -2370,9 +2370,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.1" }, - "time": "2024-05-06T12:04:23+00:00" + "time": "2024-05-31T08:52:43+00:00" }, { "name": "psr/cache", @@ -2863,26 +2863,26 @@ }, { "name": "ramsey/uuid-doctrine", - "version": "2.0.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/ramsey/uuid-doctrine.git", - "reference": "b002676be0e5e342d857c47f1b68e24de6841d08" + "reference": "491e1bfa4d9d81e52a60470fa92c871f7eef919e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid-doctrine/zipball/b002676be0e5e342d857c47f1b68e24de6841d08", - "reference": "b002676be0e5e342d857c47f1b68e24de6841d08", + "url": "https://api.github.com/repos/ramsey/uuid-doctrine/zipball/491e1bfa4d9d81e52a60470fa92c871f7eef919e", + "reference": "491e1bfa4d9d81e52a60470fa92c871f7eef919e", "shasum": "" }, "require": { - "doctrine/dbal": "^2.8 || ^3.0", - "php": "^7.4 || ^8.0", + "doctrine/dbal": "^2.8 || ^3.0 || ^4.0", + "php": "^8.1", "ramsey/uuid": "^3.9.7 || ^4.0" }, "require-dev": { "captainhook/plugin-composer": "^5.3", - "doctrine/orm": "^2.5", + "doctrine/orm": "^2.5 || ^3.0", "ergebnis/composer-normalize": "^2.28.3", "mockery/mockery": "^1.5", "php-parallel-lint/php-console-highlighter": "^1.0", @@ -2892,12 +2892,9 @@ "phpstan/phpstan": "^1.9", "phpstan/phpstan-mockery": "^1.1", "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5", - "psalm/plugin-mockery": "^1.1", - "psalm/plugin-phpunit": "^0.18.4", + "phpunit/phpunit": "^10.5", "ramsey/coding-standard": "^2.0.3", - "ramsey/conventional-commits": "^1.3", - "vimeo/psalm": "^5.4" + "ramsey/conventional-commits": "^1.3" }, "type": "library", "extra": { @@ -2934,7 +2931,7 @@ ], "support": { "issues": "https://github.com/ramsey/uuid-doctrine/issues", - "source": "https://github.com/ramsey/uuid-doctrine/tree/2.0.0" + "source": "https://github.com/ramsey/uuid-doctrine/tree/2.1.0" }, "funding": [ { @@ -2946,7 +2943,7 @@ "type": "tidelift" } ], - "time": "2022-12-20T23:38:28+00:00" + "time": "2024-05-27T00:00:21+00:00" }, { "name": "stof/doctrine-extensions-bundle", @@ -3030,16 +3027,16 @@ }, { "name": "symfony/asset", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/asset.git", - "reference": "743757ab1dfa7114a8a3c63aeb376dfcf4b0a191" + "reference": "c668aa320e26b7379540368832b9d1dd43d32603" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/asset/zipball/743757ab1dfa7114a8a3c63aeb376dfcf4b0a191", - "reference": "743757ab1dfa7114a8a3c63aeb376dfcf4b0a191", + "url": "https://api.github.com/repos/symfony/asset/zipball/c668aa320e26b7379540368832b9d1dd43d32603", + "reference": "c668aa320e26b7379540368832b9d1dd43d32603", "shasum": "" }, "require": { @@ -3079,7 +3076,7 @@ "description": "Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/asset/tree/v6.4.7" + "source": "https://github.com/symfony/asset/tree/v6.4.8" }, "funding": [ { @@ -3095,20 +3092,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/cache", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "b9e9b93c9817ec6c789c7943f5e54b57a041c16a" + "reference": "287142df5579ce223c485b3872df3efae8390984" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/b9e9b93c9817ec6c789c7943f5e54b57a041c16a", - "reference": "b9e9b93c9817ec6c789c7943f5e54b57a041c16a", + "url": "https://api.github.com/repos/symfony/cache/zipball/287142df5579ce223c485b3872df3efae8390984", + "reference": "287142df5579ce223c485b3872df3efae8390984", "shasum": "" }, "require": { @@ -3175,7 +3172,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v6.4.7" + "source": "https://github.com/symfony/cache/tree/v6.4.8" }, "funding": [ { @@ -3191,7 +3188,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/cache-contracts", @@ -3271,16 +3268,16 @@ }, { "name": "symfony/clock", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/clock.git", - "reference": "83667074bdae743f8cd884ac50b266d2af287ea8" + "reference": "7a4840efd17135cbd547e41ec49fb910ed4f8b98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/clock/zipball/83667074bdae743f8cd884ac50b266d2af287ea8", - "reference": "83667074bdae743f8cd884ac50b266d2af287ea8", + "url": "https://api.github.com/repos/symfony/clock/zipball/7a4840efd17135cbd547e41ec49fb910ed4f8b98", + "reference": "7a4840efd17135cbd547e41ec49fb910ed4f8b98", "shasum": "" }, "require": { @@ -3325,7 +3322,7 @@ "time" ], "support": { - "source": "https://github.com/symfony/clock/tree/v6.4.7" + "source": "https://github.com/symfony/clock/tree/v6.4.8" }, "funding": [ { @@ -3341,20 +3338,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:51:39+00:00" }, { "name": "symfony/config", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "51da0e4494d81bd7b5b5bd80319c55d8e0d7f4ff" + "reference": "12e7e52515ce37191b193cf3365903c4f3951e35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/51da0e4494d81bd7b5b5bd80319c55d8e0d7f4ff", - "reference": "51da0e4494d81bd7b5b5bd80319c55d8e0d7f4ff", + "url": "https://api.github.com/repos/symfony/config/zipball/12e7e52515ce37191b193cf3365903c4f3951e35", + "reference": "12e7e52515ce37191b193cf3365903c4f3951e35", "shasum": "" }, "require": { @@ -3400,7 +3397,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v6.4.7" + "source": "https://github.com/symfony/config/tree/v6.4.8" }, "funding": [ { @@ -3416,20 +3413,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/console", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f" + "reference": "be5854cee0e8c7b110f00d695d11debdfa1a2a91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", - "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", + "url": "https://api.github.com/repos/symfony/console/zipball/be5854cee0e8c7b110f00d695d11debdfa1a2a91", + "reference": "be5854cee0e8c7b110f00d695d11debdfa1a2a91", "shasum": "" }, "require": { @@ -3494,7 +3491,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.7" + "source": "https://github.com/symfony/console/tree/v6.4.8" }, "funding": [ { @@ -3510,20 +3507,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/dependency-injection", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "d8c5f9781b71c2a868ae9d0e5c9b283684740b6d" + "reference": "d3b618176e8c3a9e5772151c51eba0c52a0c771c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/d8c5f9781b71c2a868ae9d0e5c9b283684740b6d", - "reference": "d8c5f9781b71c2a868ae9d0e5c9b283684740b6d", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/d3b618176e8c3a9e5772151c51eba0c52a0c771c", + "reference": "d3b618176e8c3a9e5772151c51eba0c52a0c771c", "shasum": "" }, "require": { @@ -3575,7 +3572,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v6.4.7" + "source": "https://github.com/symfony/dependency-injection/tree/v6.4.8" }, "funding": [ { @@ -3591,7 +3588,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3662,16 +3659,16 @@ }, { "name": "symfony/doctrine-bridge", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/doctrine-bridge.git", - "reference": "0eb1189828f66c74697737e89a12b3aded8b748c" + "reference": "afbf291ccaf595c8ff6f4ed3943aa0ea479e4d04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/doctrine-bridge/zipball/0eb1189828f66c74697737e89a12b3aded8b748c", - "reference": "0eb1189828f66c74697737e89a12b3aded8b748c", + "url": "https://api.github.com/repos/symfony/doctrine-bridge/zipball/afbf291ccaf595c8ff6f4ed3943aa0ea479e4d04", + "reference": "afbf291ccaf595c8ff6f4ed3943aa0ea479e4d04", "shasum": "" }, "require": { @@ -3750,7 +3747,7 @@ "description": "Provides integration for Doctrine with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/doctrine-bridge/tree/v6.4.7" + "source": "https://github.com/symfony/doctrine-bridge/tree/v6.4.8" }, "funding": [ { @@ -3766,20 +3763,20 @@ "type": "tidelift" } ], - "time": "2024-04-22T16:59:38+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/dotenv", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/dotenv.git", - "reference": "982a8d58c73a7d91d229bc20493b8ae13208741c" + "reference": "55aefa0029adff89ecffdb560820e945c7983f06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dotenv/zipball/982a8d58c73a7d91d229bc20493b8ae13208741c", - "reference": "982a8d58c73a7d91d229bc20493b8ae13208741c", + "url": "https://api.github.com/repos/symfony/dotenv/zipball/55aefa0029adff89ecffdb560820e945c7983f06", + "reference": "55aefa0029adff89ecffdb560820e945c7983f06", "shasum": "" }, "require": { @@ -3824,7 +3821,7 @@ "environment" ], "support": { - "source": "https://github.com/symfony/dotenv/tree/v6.4.7" + "source": "https://github.com/symfony/dotenv/tree/v6.4.8" }, "funding": [ { @@ -3840,20 +3837,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/error-handler", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "667a072466c6a53827ed7b119af93806b884cbb3" + "reference": "ef836152bf13472dc5fb5b08b0c0c4cfeddc0fcc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/667a072466c6a53827ed7b119af93806b884cbb3", - "reference": "667a072466c6a53827ed7b119af93806b884cbb3", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/ef836152bf13472dc5fb5b08b0c0c4cfeddc0fcc", + "reference": "ef836152bf13472dc5fb5b08b0c0c4cfeddc0fcc", "shasum": "" }, "require": { @@ -3899,7 +3896,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v6.4.7" + "source": "https://github.com/symfony/error-handler/tree/v6.4.8" }, "funding": [ { @@ -3915,20 +3912,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "d84384f3f67de3cb650db64d685d70395dacfc3f" + "reference": "8d7507f02b06e06815e56bb39aa0128e3806208b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d84384f3f67de3cb650db64d685d70395dacfc3f", - "reference": "d84384f3f67de3cb650db64d685d70395dacfc3f", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/8d7507f02b06e06815e56bb39aa0128e3806208b", + "reference": "8d7507f02b06e06815e56bb39aa0128e3806208b", "shasum": "" }, "require": { @@ -3979,7 +3976,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v6.4.7" + "source": "https://github.com/symfony/event-dispatcher/tree/v6.4.8" }, "funding": [ { @@ -3995,7 +3992,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -4075,16 +4072,16 @@ }, { "name": "symfony/expression-language", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", - "reference": "f64e152029200cf35da13e9e1444e5fc8ff7fdfa" + "reference": "0b63cb437741a42104d3ccc9bf60bbd8e1acbd2a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/f64e152029200cf35da13e9e1444e5fc8ff7fdfa", - "reference": "f64e152029200cf35da13e9e1444e5fc8ff7fdfa", + "url": "https://api.github.com/repos/symfony/expression-language/zipball/0b63cb437741a42104d3ccc9bf60bbd8e1acbd2a", + "reference": "0b63cb437741a42104d3ccc9bf60bbd8e1acbd2a", "shasum": "" }, "require": { @@ -4119,7 +4116,7 @@ "description": "Provides an engine that can compile and evaluate expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/expression-language/tree/v6.4.7" + "source": "https://github.com/symfony/expression-language/tree/v6.4.8" }, "funding": [ { @@ -4135,27 +4132,29 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/filesystem", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "78dde75f8f6dbbca4ec436a4b0087f7af02076d4" + "reference": "4d37529150e7081c51b3c5d5718c55a04a9503f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/78dde75f8f6dbbca4ec436a4b0087f7af02076d4", - "reference": "78dde75f8f6dbbca4ec436a4b0087f7af02076d4", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/4d37529150e7081c51b3c5d5718c55a04a9503f3", + "reference": "4d37529150e7081c51b3c5d5718c55a04a9503f3", "shasum": "" }, "require": { "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8", - "symfony/process": "^5.4|^6.4" + "symfony/polyfill-mbstring": "~1.8" + }, + "require-dev": { + "symfony/process": "^5.4|^6.4|^7.0" }, "type": "library", "autoload": { @@ -4183,7 +4182,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.4.7" + "source": "https://github.com/symfony/filesystem/tree/v6.4.8" }, "funding": [ { @@ -4199,20 +4198,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/finder", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "511c48990be17358c23bf45c5d71ab85d40fb764" + "reference": "3ef977a43883215d560a2cecb82ec8e62131471c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/511c48990be17358c23bf45c5d71ab85d40fb764", - "reference": "511c48990be17358c23bf45c5d71ab85d40fb764", + "url": "https://api.github.com/repos/symfony/finder/zipball/3ef977a43883215d560a2cecb82ec8e62131471c", + "reference": "3ef977a43883215d560a2cecb82ec8e62131471c", "shasum": "" }, "require": { @@ -4247,7 +4246,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.4.7" + "source": "https://github.com/symfony/finder/tree/v6.4.8" }, "funding": [ { @@ -4263,7 +4262,7 @@ "type": "tidelift" } ], - "time": "2024-04-23T10:36:43+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/flex", @@ -4332,16 +4331,16 @@ }, { "name": "symfony/framework-bundle", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "58196b824903d203b71e580baac73eee29246ace" + "reference": "7c7739f87f1a8be1c2f5e7d28addfe763a917acb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/58196b824903d203b71e580baac73eee29246ace", - "reference": "58196b824903d203b71e580baac73eee29246ace", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/7c7739f87f1a8be1c2f5e7d28addfe763a917acb", + "reference": "7c7739f87f1a8be1c2f5e7d28addfe763a917acb", "shasum": "" }, "require": { @@ -4460,7 +4459,7 @@ "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v6.4.7" + "source": "https://github.com/symfony/framework-bundle/tree/v6.4.8" }, "funding": [ { @@ -4476,20 +4475,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/http-foundation", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "b4db6b833035477cb70e18d0ae33cb7c2b521759" + "reference": "27de8cc95e11db7a50b027e71caaab9024545947" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/b4db6b833035477cb70e18d0ae33cb7c2b521759", - "reference": "b4db6b833035477cb70e18d0ae33cb7c2b521759", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/27de8cc95e11db7a50b027e71caaab9024545947", + "reference": "27de8cc95e11db7a50b027e71caaab9024545947", "shasum": "" }, "require": { @@ -4537,7 +4536,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.4.7" + "source": "https://github.com/symfony/http-foundation/tree/v6.4.8" }, "funding": [ { @@ -4553,20 +4552,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "b7b5e6cdef670a0c82d015a966ffc7e855861a98" + "reference": "6c519aa3f32adcfd1d1f18d923f6b227d9acf3c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/b7b5e6cdef670a0c82d015a966ffc7e855861a98", - "reference": "b7b5e6cdef670a0c82d015a966ffc7e855861a98", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/6c519aa3f32adcfd1d1f18d923f6b227d9acf3c1", + "reference": "6c519aa3f32adcfd1d1f18d923f6b227d9acf3c1", "shasum": "" }, "require": { @@ -4651,7 +4650,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.4.7" + "source": "https://github.com/symfony/http-kernel/tree/v6.4.8" }, "funding": [ { @@ -4667,20 +4666,20 @@ "type": "tidelift" } ], - "time": "2024-04-29T11:24:44+00:00" + "time": "2024-06-02T16:06:25+00:00" }, { "name": "symfony/password-hasher", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/password-hasher.git", - "reference": "73afaed1d87f6127dcd71bc88e9a16fd9325cf1c" + "reference": "90ebbe946e5d64a5fad9ac9427e335045cf2bd31" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/password-hasher/zipball/73afaed1d87f6127dcd71bc88e9a16fd9325cf1c", - "reference": "73afaed1d87f6127dcd71bc88e9a16fd9325cf1c", + "url": "https://api.github.com/repos/symfony/password-hasher/zipball/90ebbe946e5d64a5fad9ac9427e335045cf2bd31", + "reference": "90ebbe946e5d64a5fad9ac9427e335045cf2bd31", "shasum": "" }, "require": { @@ -4723,7 +4722,7 @@ "password" ], "support": { - "source": "https://github.com/symfony/password-hasher/tree/v6.4.7" + "source": "https://github.com/symfony/password-hasher/tree/v6.4.8" }, "funding": [ { @@ -4739,7 +4738,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -5057,79 +5056,18 @@ ], "time": "2024-01-29T20:11:03+00:00" }, - { - "name": "symfony/process", - "version": "v6.4.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "cdb1c81c145fd5aa9b0038bab694035020943381" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/cdb1c81c145fd5aa9b0038bab694035020943381", - "reference": "cdb1c81c145fd5aa9b0038bab694035020943381", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Executes commands in sub-processes", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/process/tree/v6.4.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-04-18T09:22:46+00:00" - }, { "name": "symfony/property-access", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "9174e2ec62563dfc15fbe84d1618613092e09d91" + "reference": "e4d9b00983612f9c0013ca37c61affdba2dd975a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/9174e2ec62563dfc15fbe84d1618613092e09d91", - "reference": "9174e2ec62563dfc15fbe84d1618613092e09d91", + "url": "https://api.github.com/repos/symfony/property-access/zipball/e4d9b00983612f9c0013ca37c61affdba2dd975a", + "reference": "e4d9b00983612f9c0013ca37c61affdba2dd975a", "shasum": "" }, "require": { @@ -5177,7 +5115,7 @@ "reflection" ], "support": { - "source": "https://github.com/symfony/property-access/tree/v6.4.7" + "source": "https://github.com/symfony/property-access/tree/v6.4.8" }, "funding": [ { @@ -5193,20 +5131,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/property-info", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/property-info.git", - "reference": "42778ca731b8796e02e237008f4ed871361ddfce" + "reference": "7f544bc6ceb1a6a2283c7af8e8621262c43b7ede" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-info/zipball/42778ca731b8796e02e237008f4ed871361ddfce", - "reference": "42778ca731b8796e02e237008f4ed871361ddfce", + "url": "https://api.github.com/repos/symfony/property-info/zipball/7f544bc6ceb1a6a2283c7af8e8621262c43b7ede", + "reference": "7f544bc6ceb1a6a2283c7af8e8621262c43b7ede", "shasum": "" }, "require": { @@ -5260,7 +5198,7 @@ "validator" ], "support": { - "source": "https://github.com/symfony/property-info/tree/v6.4.7" + "source": "https://github.com/symfony/property-info/tree/v6.4.8" }, "funding": [ { @@ -5276,20 +5214,20 @@ "type": "tidelift" } ], - "time": "2024-04-28T10:28:08+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/routing", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "276e06398f71fa2a973264d94f28150f93cfb907" + "reference": "8a40d0f9b01f0fbb80885d3ce0ad6714fb603a58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/276e06398f71fa2a973264d94f28150f93cfb907", - "reference": "276e06398f71fa2a973264d94f28150f93cfb907", + "url": "https://api.github.com/repos/symfony/routing/zipball/8a40d0f9b01f0fbb80885d3ce0ad6714fb603a58", + "reference": "8a40d0f9b01f0fbb80885d3ce0ad6714fb603a58", "shasum": "" }, "require": { @@ -5343,7 +5281,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v6.4.7" + "source": "https://github.com/symfony/routing/tree/v6.4.8" }, "funding": [ { @@ -5359,20 +5297,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/runtime", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/runtime.git", - "reference": "20c90eb66bbf82fdb3ef74f2ea4ecf08518cbb5e" + "reference": "b4bfa2fd4cad1fee62f80b3dfe4eb674cc3302a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/runtime/zipball/20c90eb66bbf82fdb3ef74f2ea4ecf08518cbb5e", - "reference": "20c90eb66bbf82fdb3ef74f2ea4ecf08518cbb5e", + "url": "https://api.github.com/repos/symfony/runtime/zipball/b4bfa2fd4cad1fee62f80b3dfe4eb674cc3302a0", + "reference": "b4bfa2fd4cad1fee62f80b3dfe4eb674cc3302a0", "shasum": "" }, "require": { @@ -5422,7 +5360,7 @@ "runtime" ], "support": { - "source": "https://github.com/symfony/runtime/tree/v6.4.7" + "source": "https://github.com/symfony/runtime/tree/v6.4.8" }, "funding": [ { @@ -5438,20 +5376,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/security-bundle", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/security-bundle.git", - "reference": "c9112933215b9b3c48851eb6644263d5c9d93245" + "reference": "dfb286069b0332e1f1c21962133d17c0fbc1e5e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-bundle/zipball/c9112933215b9b3c48851eb6644263d5c9d93245", - "reference": "c9112933215b9b3c48851eb6644263d5c9d93245", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/dfb286069b0332e1f1c21962133d17c0fbc1e5e7", + "reference": "dfb286069b0332e1f1c21962133d17c0fbc1e5e7", "shasum": "" }, "require": { @@ -5534,7 +5472,7 @@ "description": "Provides a tight integration of the Security component into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-bundle/tree/v6.4.7" + "source": "https://github.com/symfony/security-bundle/tree/v6.4.8" }, "funding": [ { @@ -5550,20 +5488,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/security-core", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/security-core.git", - "reference": "54d35e432abd5c86bf7ba97e521168d364ac50b0" + "reference": "5fc7850ada5e8e03d78c1739c82c64d5e2f7d495" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/54d35e432abd5c86bf7ba97e521168d364ac50b0", - "reference": "54d35e432abd5c86bf7ba97e521168d364ac50b0", + "url": "https://api.github.com/repos/symfony/security-core/zipball/5fc7850ada5e8e03d78c1739c82c64d5e2f7d495", + "reference": "5fc7850ada5e8e03d78c1739c82c64d5e2f7d495", "shasum": "" }, "require": { @@ -5620,7 +5558,7 @@ "description": "Symfony Security Component - Core Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-core/tree/v6.4.7" + "source": "https://github.com/symfony/security-core/tree/v6.4.8" }, "funding": [ { @@ -5636,20 +5574,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/security-csrf", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/security-csrf.git", - "reference": "91fe7e829a8fe1e78bd3615c7a410dce6876325b" + "reference": "f46ab02b76311087873257071559edcaf6d7ab99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-csrf/zipball/91fe7e829a8fe1e78bd3615c7a410dce6876325b", - "reference": "91fe7e829a8fe1e78bd3615c7a410dce6876325b", + "url": "https://api.github.com/repos/symfony/security-csrf/zipball/f46ab02b76311087873257071559edcaf6d7ab99", + "reference": "f46ab02b76311087873257071559edcaf6d7ab99", "shasum": "" }, "require": { @@ -5688,7 +5626,7 @@ "description": "Symfony Security Component - CSRF Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-csrf/tree/v6.4.7" + "source": "https://github.com/symfony/security-csrf/tree/v6.4.8" }, "funding": [ { @@ -5704,20 +5642,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/security-http", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/security-http.git", - "reference": "01643fd75e415bc463d63e86bb27afccf5477745" + "reference": "fb82ddec887dc67f3bcf4d6df3cb8efd529be104" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-http/zipball/01643fd75e415bc463d63e86bb27afccf5477745", - "reference": "01643fd75e415bc463d63e86bb27afccf5477745", + "url": "https://api.github.com/repos/symfony/security-http/zipball/fb82ddec887dc67f3bcf4d6df3cb8efd529be104", + "reference": "fb82ddec887dc67f3bcf4d6df3cb8efd529be104", "shasum": "" }, "require": { @@ -5776,7 +5714,7 @@ "description": "Symfony Security Component - HTTP Integration", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-http/tree/v6.4.7" + "source": "https://github.com/symfony/security-http/tree/v6.4.8" }, "funding": [ { @@ -5792,20 +5730,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T17:31:08+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/serializer", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "73820ab43d12c2f29445080004054b0066082bf1" + "reference": "d6eda9966a3e5d1823c1cedf41bf98f8ed969d7c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/73820ab43d12c2f29445080004054b0066082bf1", - "reference": "73820ab43d12c2f29445080004054b0066082bf1", + "url": "https://api.github.com/repos/symfony/serializer/zipball/d6eda9966a3e5d1823c1cedf41bf98f8ed969d7c", + "reference": "d6eda9966a3e5d1823c1cedf41bf98f8ed969d7c", "shasum": "" }, "require": { @@ -5874,7 +5812,7 @@ "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/serializer/tree/v6.4.7" + "source": "https://github.com/symfony/serializer/tree/v6.4.8" }, "funding": [ { @@ -5890,7 +5828,7 @@ "type": "tidelift" } ], - "time": "2024-04-23T09:00:49+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/service-contracts", @@ -5977,16 +5915,16 @@ }, { "name": "symfony/stopwatch", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "ffec95ba269e541eb2232126c0c20f83086b5c68" + "reference": "63e069eb616049632cde9674c46957819454b8aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/ffec95ba269e541eb2232126c0c20f83086b5c68", - "reference": "ffec95ba269e541eb2232126c0c20f83086b5c68", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/63e069eb616049632cde9674c46957819454b8aa", + "reference": "63e069eb616049632cde9674c46957819454b8aa", "shasum": "" }, "require": { @@ -6019,7 +5957,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v6.4.7" + "source": "https://github.com/symfony/stopwatch/tree/v6.4.8" }, "funding": [ { @@ -6035,20 +5973,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/string", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "ffeb9591c61f65a68d47f77d12b83fa530227a69" + "reference": "a147c0f826c4a1f3afb763ab8e009e37c877a44d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ffeb9591c61f65a68d47f77d12b83fa530227a69", - "reference": "ffeb9591c61f65a68d47f77d12b83fa530227a69", + "url": "https://api.github.com/repos/symfony/string/zipball/a147c0f826c4a1f3afb763ab8e009e37c877a44d", + "reference": "a147c0f826c4a1f3afb763ab8e009e37c877a44d", "shasum": "" }, "require": { @@ -6105,7 +6043,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.7" + "source": "https://github.com/symfony/string/tree/v6.4.8" }, "funding": [ { @@ -6121,7 +6059,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/translation-contracts", @@ -6203,16 +6141,16 @@ }, { "name": "symfony/twig-bridge", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "544e47a4f2d4a786abd65531d2c326fb6e53da72" + "reference": "57de1b7d7499053a2c5beb9344751e8bfd332649" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/544e47a4f2d4a786abd65531d2c326fb6e53da72", - "reference": "544e47a4f2d4a786abd65531d2c326fb6e53da72", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/57de1b7d7499053a2c5beb9344751e8bfd332649", + "reference": "57de1b7d7499053a2c5beb9344751e8bfd332649", "shasum": "" }, "require": { @@ -6292,7 +6230,7 @@ "description": "Provides integration for Twig with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bridge/tree/v6.4.7" + "source": "https://github.com/symfony/twig-bridge/tree/v6.4.8" }, "funding": [ { @@ -6308,20 +6246,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/twig-bundle", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/twig-bundle.git", - "reference": "33cf43405366beb08b9b95db9cfebe2a8a63cb03" + "reference": "ef17bc8fc2cb2376b235cd1b98f0275a78c5ba65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/33cf43405366beb08b9b95db9cfebe2a8a63cb03", - "reference": "33cf43405366beb08b9b95db9cfebe2a8a63cb03", + "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/ef17bc8fc2cb2376b235cd1b98f0275a78c5ba65", + "reference": "ef17bc8fc2cb2376b235cd1b98f0275a78c5ba65", "shasum": "" }, "require": { @@ -6376,7 +6314,7 @@ "description": "Provides a tight integration of Twig into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bundle/tree/v6.4.7" + "source": "https://github.com/symfony/twig-bundle/tree/v6.4.8" }, "funding": [ { @@ -6392,20 +6330,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/validator", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "4761a08d161d823ec281151ade0905547e0502a7" + "reference": "dab2781371d54c86f6b25623ab16abb2dde2870c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/4761a08d161d823ec281151ade0905547e0502a7", - "reference": "4761a08d161d823ec281151ade0905547e0502a7", + "url": "https://api.github.com/repos/symfony/validator/zipball/dab2781371d54c86f6b25623ab16abb2dde2870c", + "reference": "dab2781371d54c86f6b25623ab16abb2dde2870c", "shasum": "" }, "require": { @@ -6452,7 +6390,8 @@ "Symfony\\Component\\Validator\\": "" }, "exclude-from-classmap": [ - "/Tests/" + "/Tests/", + "/Resources/bin/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -6472,7 +6411,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v6.4.7" + "source": "https://github.com/symfony/validator/tree/v6.4.8" }, "funding": [ { @@ -6488,20 +6427,20 @@ "type": "tidelift" } ], - "time": "2024-04-28T10:38:38+00:00" + "time": "2024-06-02T15:48:50+00:00" }, { "name": "symfony/var-dumper", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "7a9cd977cd1c5fed3694bee52990866432af07d7" + "reference": "ad23ca4312395f0a8a8633c831ef4c4ee542ed25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/7a9cd977cd1c5fed3694bee52990866432af07d7", - "reference": "7a9cd977cd1c5fed3694bee52990866432af07d7", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/ad23ca4312395f0a8a8633c831ef4c4ee542ed25", + "reference": "ad23ca4312395f0a8a8633c831ef4c4ee542ed25", "shasum": "" }, "require": { @@ -6557,7 +6496,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.4.7" + "source": "https://github.com/symfony/var-dumper/tree/v6.4.8" }, "funding": [ { @@ -6573,20 +6512,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/var-exporter", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "825f9b00c37bbe1c1691cc1aff9b5451fc9b4405" + "reference": "792ca836f99b340f2e9ca9497c7953948c49a504" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/825f9b00c37bbe1c1691cc1aff9b5451fc9b4405", - "reference": "825f9b00c37bbe1c1691cc1aff9b5451fc9b4405", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/792ca836f99b340f2e9ca9497c7953948c49a504", + "reference": "792ca836f99b340f2e9ca9497c7953948c49a504", "shasum": "" }, "require": { @@ -6634,7 +6573,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v6.4.7" + "source": "https://github.com/symfony/var-exporter/tree/v6.4.8" }, "funding": [ { @@ -6650,20 +6589,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/web-link", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/web-link.git", - "reference": "63e03d53df4ddb7e054d7dc5a43f58be9c67bd7a" + "reference": "304c67cefe7128ea3957e9bb1ac6ce08a90a635b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/web-link/zipball/63e03d53df4ddb7e054d7dc5a43f58be9c67bd7a", - "reference": "63e03d53df4ddb7e054d7dc5a43f58be9c67bd7a", + "url": "https://api.github.com/repos/symfony/web-link/zipball/304c67cefe7128ea3957e9bb1ac6ce08a90a635b", + "reference": "304c67cefe7128ea3957e9bb1ac6ce08a90a635b", "shasum": "" }, "require": { @@ -6717,7 +6656,7 @@ "push" ], "support": { - "source": "https://github.com/symfony/web-link/tree/v6.4.7" + "source": "https://github.com/symfony/web-link/tree/v6.4.8" }, "funding": [ { @@ -6733,20 +6672,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/yaml", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "53e8b1ef30a65f78eac60fddc5ee7ebbbdb1dee0" + "reference": "52903de178d542850f6f341ba92995d3d63e60c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/53e8b1ef30a65f78eac60fddc5ee7ebbbdb1dee0", - "reference": "53e8b1ef30a65f78eac60fddc5ee7ebbbdb1dee0", + "url": "https://api.github.com/repos/symfony/yaml/zipball/52903de178d542850f6f341ba92995d3d63e60c9", + "reference": "52903de178d542850f6f341ba92995d3d63e60c9", "shasum": "" }, "require": { @@ -6789,7 +6728,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.4.7" + "source": "https://github.com/symfony/yaml/tree/v6.4.8" }, "funding": [ { @@ -6805,7 +6744,7 @@ "type": "tidelift" } ], - "time": "2024-04-28T10:28:08+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "twig/twig", @@ -7004,21 +6943,21 @@ "packages-dev": [ { "name": "dama/doctrine-test-bundle", - "version": "v8.1.0", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/dmaicher/doctrine-test-bundle.git", - "reference": "21b4dd73546991c7df34ba92ecbf305a1ae5a0ee" + "reference": "1f81a280ea63f049d24e9c8ce00e557b18e0ff2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dmaicher/doctrine-test-bundle/zipball/21b4dd73546991c7df34ba92ecbf305a1ae5a0ee", - "reference": "21b4dd73546991c7df34ba92ecbf305a1ae5a0ee", + "url": "https://api.github.com/repos/dmaicher/doctrine-test-bundle/zipball/1f81a280ea63f049d24e9c8ce00e557b18e0ff2f", + "reference": "1f81a280ea63f049d24e9c8ce00e557b18e0ff2f", "shasum": "" }, "require": { "doctrine/dbal": "^3.3 || ^4.0", - "doctrine/doctrine-bundle": "^2.2.2", + "doctrine/doctrine-bundle": "^2.11.0", "php": "^7.4 || ^8.0", "psr/cache": "^1.0 || ^2.0 || ^3.0", "symfony/cache": "^5.4 || ^6.3 || ^7.0", @@ -7065,9 +7004,9 @@ ], "support": { "issues": "https://github.com/dmaicher/doctrine-test-bundle/issues", - "source": "https://github.com/dmaicher/doctrine-test-bundle/tree/v8.1.0" + "source": "https://github.com/dmaicher/doctrine-test-bundle/tree/v8.2.0" }, - "time": "2024-05-21T18:06:21+00:00" + "time": "2024-05-28T15:41:06+00:00" }, { "name": "doctrine/data-fixtures", @@ -7155,16 +7094,16 @@ }, { "name": "doctrine/doctrine-fixtures-bundle", - "version": "3.6.0", + "version": "3.6.1", "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineFixturesBundle.git", - "reference": "87f5d53708a3855aa018bf0a00d0d4b0ef58a956" + "reference": "d13a08ebf244f74c8adb8ff15aa55d01c404e534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/87f5d53708a3855aa018bf0a00d0d4b0ef58a956", - "reference": "87f5d53708a3855aa018bf0a00d0d4b0ef58a956", + "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/d13a08ebf244f74c8adb8ff15aa55d01c404e534", + "reference": "d13a08ebf244f74c8adb8ff15aa55d01c404e534", "shasum": "" }, "require": { @@ -7222,7 +7161,7 @@ ], "support": { "issues": "https://github.com/doctrine/DoctrineFixturesBundle/issues", - "source": "https://github.com/doctrine/DoctrineFixturesBundle/tree/3.6.0" + "source": "https://github.com/doctrine/DoctrineFixturesBundle/tree/3.6.1" }, "funding": [ { @@ -7238,7 +7177,7 @@ "type": "tidelift" } ], - "time": "2024-05-02T18:06:53+00:00" + "time": "2024-05-07T07:16:35+00:00" }, { "name": "fakerphp/faker", @@ -8992,16 +8931,16 @@ }, { "name": "symfony/browser-kit", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "c276856598f70e96f75403fc04841cec1dc56e74" + "reference": "62ab90b92066ef6cce5e79365625b4b1432464c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/c276856598f70e96f75403fc04841cec1dc56e74", - "reference": "c276856598f70e96f75403fc04841cec1dc56e74", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/62ab90b92066ef6cce5e79365625b4b1432464c8", + "reference": "62ab90b92066ef6cce5e79365625b4b1432464c8", "shasum": "" }, "require": { @@ -9040,7 +8979,7 @@ "description": "Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/browser-kit/tree/v6.4.7" + "source": "https://github.com/symfony/browser-kit/tree/v6.4.8" }, "funding": [ { @@ -9056,20 +8995,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/css-selector", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "1c5d5c2103c3762aff27a27e1e2409e30a79083b" + "reference": "4b61b02fe15db48e3687ce1c45ea385d1780fe08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/1c5d5c2103c3762aff27a27e1e2409e30a79083b", - "reference": "1c5d5c2103c3762aff27a27e1e2409e30a79083b", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/4b61b02fe15db48e3687ce1c45ea385d1780fe08", + "reference": "4b61b02fe15db48e3687ce1c45ea385d1780fe08", "shasum": "" }, "require": { @@ -9105,7 +9044,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v6.4.7" + "source": "https://github.com/symfony/css-selector/tree/v6.4.8" }, "funding": [ { @@ -9121,20 +9060,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/dom-crawler", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "2088c5da700b1e7a8689fffc10dda6c1f643deea" + "reference": "105b56a0305d219349edeb60a800082eca864e4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/2088c5da700b1e7a8689fffc10dda6c1f643deea", - "reference": "2088c5da700b1e7a8689fffc10dda6c1f643deea", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/105b56a0305d219349edeb60a800082eca864e4b", + "reference": "105b56a0305d219349edeb60a800082eca864e4b", "shasum": "" }, "require": { @@ -9172,7 +9111,7 @@ "description": "Eases DOM navigation for HTML and XML documents", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dom-crawler/tree/v6.4.7" + "source": "https://github.com/symfony/dom-crawler/tree/v6.4.8" }, "funding": [ { @@ -9188,20 +9127,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/http-client", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "3683d8107cf1efdd24795cc5f7482be1eded34ac" + "reference": "61faba993e620fc22d4f0ab3b6bcf8fbb0d44b05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/3683d8107cf1efdd24795cc5f7482be1eded34ac", - "reference": "3683d8107cf1efdd24795cc5f7482be1eded34ac", + "url": "https://api.github.com/repos/symfony/http-client/zipball/61faba993e620fc22d4f0ab3b6bcf8fbb0d44b05", + "reference": "61faba993e620fc22d4f0ab3b6bcf8fbb0d44b05", "shasum": "" }, "require": { @@ -9265,7 +9204,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v6.4.7" + "source": "https://github.com/symfony/http-client/tree/v6.4.8" }, "funding": [ { @@ -9281,7 +9220,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/http-client-contracts", @@ -9363,16 +9302,16 @@ }, { "name": "symfony/maker-bundle", - "version": "v1.59.1", + "version": "v1.60.0", "source": { "type": "git", "url": "https://github.com/symfony/maker-bundle.git", - "reference": "b87b1b25c607a8a50832395bc751c784946a0350" + "reference": "c305a02a22974670f359d4274c9431e1a191f559" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/b87b1b25c607a8a50832395bc751c784946a0350", - "reference": "b87b1b25c607a8a50832395bc751c784946a0350", + "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/c305a02a22974670f359d4274c9431e1a191f559", + "reference": "c305a02a22974670f359d4274c9431e1a191f559", "shasum": "" }, "require": { @@ -9435,7 +9374,7 @@ ], "support": { "issues": "https://github.com/symfony/maker-bundle/issues", - "source": "https://github.com/symfony/maker-bundle/tree/v1.59.1" + "source": "https://github.com/symfony/maker-bundle/tree/v1.60.0" }, "funding": [ { @@ -9451,20 +9390,20 @@ "type": "tidelift" } ], - "time": "2024-05-06T03:59:59+00:00" + "time": "2024-06-10T06:03:18+00:00" }, { "name": "symfony/phpunit-bridge", - "version": "v7.0.7", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "0a0b90ba08b9a03e09ad49f8d613bdf3eca3a7a9" + "reference": "3e1cb8c4dee341cfe96ae9fe29b1acda52a6bb16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/0a0b90ba08b9a03e09ad49f8d613bdf3eca3a7a9", - "reference": "0a0b90ba08b9a03e09ad49f8d613bdf3eca3a7a9", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/3e1cb8c4dee341cfe96ae9fe29b1acda52a6bb16", + "reference": "3e1cb8c4dee341cfe96ae9fe29b1acda52a6bb16", "shasum": "" }, "require": { @@ -9496,7 +9435,8 @@ "Symfony\\Bridge\\PhpUnit\\": "" }, "exclude-from-classmap": [ - "/Tests/" + "/Tests/", + "/bin/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -9516,7 +9456,7 @@ "description": "Provides utilities for PHPUnit, especially user deprecation notices management", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/phpunit-bridge/tree/v7.0.7" + "source": "https://github.com/symfony/phpunit-bridge/tree/v7.1.1" }, "funding": [ { @@ -9532,20 +9472,81 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-06-04T06:50:37+00:00" }, { - "name": "symfony/web-profiler-bundle", - "version": "v6.4.7", + "name": "symfony/process", + "version": "v6.4.8", "source": { "type": "git", - "url": "https://github.com/symfony/web-profiler-bundle.git", - "reference": "60fd8e550e08308ff8d2e88cfc50bb6c040a2fc3" + "url": "https://github.com/symfony/process.git", + "reference": "8d92dd79149f29e89ee0f480254db595f6a6a2c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/60fd8e550e08308ff8d2e88cfc50bb6c040a2fc3", - "reference": "60fd8e550e08308ff8d2e88cfc50bb6c040a2fc3", + "url": "https://api.github.com/repos/symfony/process/zipball/8d92dd79149f29e89ee0f480254db595f6a6a2c5", + "reference": "8d92dd79149f29e89ee0f480254db595f6a6a2c5", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v6.4.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-05-31T14:49:08+00:00" + }, + { + "name": "symfony/web-profiler-bundle", + "version": "v6.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/web-profiler-bundle.git", + "reference": "bcc806d1360991de3bf78ac5ca0202db85de9bfc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/bcc806d1360991de3bf78ac5ca0202db85de9bfc", + "reference": "bcc806d1360991de3bf78ac5ca0202db85de9bfc", "shasum": "" }, "require": { @@ -9598,7 +9599,7 @@ "dev" ], "support": { - "source": "https://github.com/symfony/web-profiler-bundle/tree/v6.4.7" + "source": "https://github.com/symfony/web-profiler-bundle/tree/v6.4.8" }, "funding": [ { @@ -9614,7 +9615,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "theseer/tokenizer", @@ -9783,16 +9784,16 @@ }, { "name": "zenstruck/foundry", - "version": "v1.37.0", + "version": "v1.38.0", "source": { "type": "git", "url": "https://github.com/zenstruck/foundry.git", - "reference": "e01d77f01d2837e568ed92d226e6e778c37319a4" + "reference": "fd3c763de120445878077e54c608d8d75a3cc22d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zenstruck/foundry/zipball/e01d77f01d2837e568ed92d226e6e778c37319a4", - "reference": "e01d77f01d2837e568ed92d226e6e778c37319a4", + "url": "https://api.github.com/repos/zenstruck/foundry/zipball/fd3c763de120445878077e54c608d8d75a3cc22d", + "reference": "fd3c763de120445878077e54c608d8d75a3cc22d", "shasum": "" }, "require": { @@ -9809,7 +9810,7 @@ "doctrine/mongodb-odm": "2.5.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4", + "bamarni/composer-bin-plugin": "^1.8", "dama/doctrine-test-bundle": "^7.0|^8.0", "doctrine/doctrine-bundle": "^2.5", "doctrine/doctrine-migrations-bundle": "^2.2|^3.0", @@ -9834,10 +9835,12 @@ }, "autoload": { "files": [ - "src/functions.php" + "src/functions.php", + "src/Persistence/functions.php" ], "psr-4": { - "Zenstruck\\Foundry\\": "src/" + "Zenstruck\\Foundry\\": "src/", + "Zenstruck\\Foundry\\Utils\\Rector\\": "utils/rector/src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -9863,7 +9866,7 @@ ], "support": { "issues": "https://github.com/zenstruck/foundry/issues", - "source": "https://github.com/zenstruck/foundry/tree/v1.37.0" + "source": "https://github.com/zenstruck/foundry/tree/v1.38.0" }, "funding": [ { @@ -9871,7 +9874,7 @@ "type": "github" } ], - "time": "2024-03-20T15:09:26+00:00" + "time": "2024-06-07T23:04:21+00:00" } ], "aliases": [], diff --git a/config/api_platform/Client.yaml b/config/api_platform/Client.yaml new file mode 100644 index 0000000..b61769b --- /dev/null +++ b/config/api_platform/Client.yaml @@ -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 \ No newline at end of file diff --git a/config/api_platform/Hardware.yaml b/config/api_platform/Hardware.yaml new file mode 100644 index 0000000..c932488 --- /dev/null +++ b/config/api_platform/Hardware.yaml @@ -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 \ No newline at end of file diff --git a/config/api_platform/HardwareProfile.yaml b/config/api_platform/HardwareProfile.yaml new file mode 100644 index 0000000..06c3587 --- /dev/null +++ b/config/api_platform/HardwareProfile.yaml @@ -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 \ No newline at end of file diff --git a/config/api_platform/HardwareType.yaml b/config/api_platform/HardwareType.yaml new file mode 100644 index 0000000..793a9e9 --- /dev/null +++ b/config/api_platform/HardwareType.yaml @@ -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 \ No newline at end of file diff --git a/config/api_platform/Image.yaml b/config/api_platform/Image.yaml new file mode 100644 index 0000000..37ab891 --- /dev/null +++ b/config/api_platform/Image.yaml @@ -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 \ No newline at end of file diff --git a/config/api_platform/Menu.yaml b/config/api_platform/Menu.yaml new file mode 100644 index 0000000..54ab3bf --- /dev/null +++ b/config/api_platform/Menu.yaml @@ -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 \ No newline at end of file diff --git a/config/api_platform/OperativeSystem.yaml b/config/api_platform/OperativeSystem.yaml new file mode 100644 index 0000000..ba4ed52 --- /dev/null +++ b/config/api_platform/OperativeSystem.yaml @@ -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 \ No newline at end of file diff --git a/config/api_platform/OrganizationalUnit.yaml b/config/api_platform/OrganizationalUnit.yaml index 577b80a..ac90e14 100644 --- a/config/api_platform/OrganizationalUnit.yaml +++ b/config/api_platform/OrganizationalUnit.yaml @@ -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: diff --git a/config/api_platform/Partition.yaml b/config/api_platform/Partition.yaml new file mode 100644 index 0000000..7d09114 --- /dev/null +++ b/config/api_platform/Partition.yaml @@ -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 \ No newline at end of file diff --git a/config/api_platform/Software.yaml b/config/api_platform/Software.yaml new file mode 100644 index 0000000..4e34a66 --- /dev/null +++ b/config/api_platform/Software.yaml @@ -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 \ No newline at end of file diff --git a/config/api_platform/SoftwareProfile.yaml b/config/api_platform/SoftwareProfile.yaml new file mode 100644 index 0000000..f5c544c --- /dev/null +++ b/config/api_platform/SoftwareProfile.yaml @@ -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 \ No newline at end of file diff --git a/config/api_platform/User.yaml b/config/api_platform/User.yaml index 7579dd9..14528e5 100644 --- a/config/api_platform/User.yaml +++ b/config/api_platform/User.yaml @@ -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' diff --git a/config/api_platform/UserGroup.yaml b/config/api_platform/UserGroup.yaml index 0f2a80b..796e526 100644 --- a/config/api_platform/UserGroup.yaml +++ b/config/api_platform/UserGroup.yaml @@ -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: diff --git a/config/packages/api_platform.yaml b/config/packages/api_platform.yaml index 6a6729c..8871ca7 100644 --- a/config/packages/api_platform.yaml +++ b/config/packages/api_platform.yaml @@ -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: diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index b247cd0..5dedfc1 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -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 diff --git a/config/services.yaml b/config/services.yaml index 7e12544..a26d706 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -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' ] @@ -38,4 +39,54 @@ services: App\State\Provider\OrganizationalUnitProvider: bind: $collectionProvider: '@api_platform.doctrine.orm.state.collection_provider' - $itemProvider: '@api_platform.doctrine.orm.state.item_provider' \ No newline at end of file + $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' diff --git a/config/services/api_platform.yaml b/config/services/api_platform.yaml index 8049096..d8f0fa4 100644 --- a/config/services/api_platform.yaml +++ b/config/services/api_platform.yaml @@ -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' ] \ No newline at end of file + tags: [ 'api_platform.filter' ] + + diff --git a/docker-compose.yaml b/docker-compose.yaml index b970b39..aad1b74 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -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 diff --git a/docker/Dockerfile-php b/docker/Dockerfile-php index 0ce2698..da6f17e 100644 --- a/docker/Dockerfile-php +++ b/docker/Dockerfile-php @@ -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 + diff --git a/docker/xdebug.ini b/docker/xdebug.ini new file mode 100644 index 0000000..af39592 --- /dev/null +++ b/docker/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} \ No newline at end of file diff --git a/migrations/Version20240528093352.php b/migrations/Version20240617113606.php similarity index 51% rename from migrations/Version20240528093352.php rename to migrations/Version20240617113606.php index 60ec26a..3c98a3c 100644 --- a/migrations/Version20240528093352.php +++ b/migrations/Version20240617113606.php @@ -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'); diff --git a/migrations/Version20240618062825.php b/migrations/Version20240618062825.php new file mode 100644 index 0000000..7cb73fe --- /dev/null +++ b/migrations/Version20240618062825.php @@ -0,0 +1,39 @@ +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'); + } +} diff --git a/migrations/Version20240618083013.php b/migrations/Version20240618083013.php new file mode 100644 index 0000000..df541b8 --- /dev/null +++ b/migrations/Version20240618083013.php @@ -0,0 +1,41 @@ +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'); + } +} diff --git a/migrations/Version20240618113629.php b/migrations/Version20240618113629.php new file mode 100644 index 0000000..c9e1d5a --- /dev/null +++ b/migrations/Version20240618113629.php @@ -0,0 +1,31 @@ +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'); + } +} diff --git a/migrations/Version20240619083230.php b/migrations/Version20240619083230.php new file mode 100644 index 0000000..ea1e30b --- /dev/null +++ b/migrations/Version20240619083230.php @@ -0,0 +1,33 @@ +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'); + } +} diff --git a/migrations/Version20240619084701.php b/migrations/Version20240619084701.php new file mode 100644 index 0000000..22e781b --- /dev/null +++ b/migrations/Version20240619084701.php @@ -0,0 +1,31 @@ +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'); + } +} diff --git a/migrations/Version20240619104206.php b/migrations/Version20240619104206.php new file mode 100644 index 0000000..d4654c9 --- /dev/null +++ b/migrations/Version20240619104206.php @@ -0,0 +1,35 @@ +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'); + } +} diff --git a/migrations/Version20240620095914.php b/migrations/Version20240620095914.php new file mode 100644 index 0000000..5e4d7f2 --- /dev/null +++ b/migrations/Version20240620095914.php @@ -0,0 +1,33 @@ +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)'); + } +} diff --git a/migrations/Version20240620100039.php b/migrations/Version20240620100039.php new file mode 100644 index 0000000..7aa27c5 --- /dev/null +++ b/migrations/Version20240620100039.php @@ -0,0 +1,33 @@ +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'); + } +} diff --git a/migrations/Version20240621085144.php b/migrations/Version20240621085144.php new file mode 100644 index 0000000..8286ec6 --- /dev/null +++ b/migrations/Version20240621085144.php @@ -0,0 +1,33 @@ +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)'); + } +} diff --git a/migrations/Version20240529131520.php b/migrations/Version20240701123613.php similarity index 51% rename from migrations/Version20240529131520.php rename to migrations/Version20240701123613.php index b596cab..e83b75e 100644 --- a/migrations/Version20240529131520.php +++ b/migrations/Version20240701123613.php @@ -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)'); } } diff --git a/migrations/Version20240702132742.php b/migrations/Version20240702132742.php new file mode 100644 index 0000000..91069d5 --- /dev/null +++ b/migrations/Version20240702132742.php @@ -0,0 +1,41 @@ +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'); + } +} diff --git a/migrations/Version20240703090301.php b/migrations/Version20240703090301.php new file mode 100644 index 0000000..9a7588b --- /dev/null +++ b/migrations/Version20240703090301.php @@ -0,0 +1,35 @@ +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'); + } +} diff --git a/migrations/Version20240715084147.php b/migrations/Version20240715084147.php new file mode 100644 index 0000000..0db212c --- /dev/null +++ b/migrations/Version20240715084147.php @@ -0,0 +1,43 @@ +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'); + } +} diff --git a/src/Command/Migration/MigrateClientsCommand.php b/src/Command/Migration/MigrateClientsCommand.php new file mode 100644 index 0000000..1dc517c --- /dev/null +++ b/src/Command/Migration/MigrateClientsCommand.php @@ -0,0 +1,86 @@ +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; + } + +} \ No newline at end of file diff --git a/src/Command/Migration/MigrateHardwareAndHardwareProfileCommand.php b/src/Command/Migration/MigrateHardwareAndHardwareProfileCommand.php new file mode 100644 index 0000000..0fdfd04 --- /dev/null +++ b/src/Command/Migration/MigrateHardwareAndHardwareProfileCommand.php @@ -0,0 +1,155 @@ +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; + } +} diff --git a/src/Command/Migration/MigrateOperativeSystemCommand.php b/src/Command/Migration/MigrateOperativeSystemCommand.php new file mode 100644 index 0000000..4fec7a6 --- /dev/null +++ b/src/Command/Migration/MigrateOperativeSystemCommand.php @@ -0,0 +1,59 @@ +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; + } +} \ No newline at end of file diff --git a/src/Command/Migration/MigrateOrganizationalUnitCommand.php b/src/Command/Migration/MigrateOrganizationalUnitCommand.php index a595626..8d2826c 100644 --- a/src/Command/Migration/MigrateOrganizationalUnitCommand.php +++ b/src/Command/Migration/MigrateOrganizationalUnitCommand.php @@ -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; } } \ No newline at end of file diff --git a/src/Command/Migration/MigrateSoftwareAndSoftwareProfileCommand.php b/src/Command/Migration/MigrateSoftwareAndSoftwareProfileCommand.php new file mode 100644 index 0000000..6daf869 --- /dev/null +++ b/src/Command/Migration/MigrateSoftwareAndSoftwareProfileCommand.php @@ -0,0 +1,57 @@ +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); + } + } +} \ No newline at end of file diff --git a/src/Controller/ChangeOrganizationalUnitAction.php b/src/Controller/ChangeOrganizationalUnitAction.php new file mode 100644 index 0000000..4d0609b --- /dev/null +++ b/src/Controller/ChangeOrganizationalUnitAction.php @@ -0,0 +1,42 @@ +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); + } +} \ No newline at end of file diff --git a/src/Controller/OrganizationalUnitChangeParentAction.php b/src/Controller/OrganizationalUnitChangeParentAction.php new file mode 100644 index 0000000..478d702 --- /dev/null +++ b/src/Controller/OrganizationalUnitChangeParentAction.php @@ -0,0 +1,29 @@ +organizationalUnitChangeParentHandler->handle($organizationalUnit); + + return new JsonResponse(data: 'Organizational unit parent changed successfully', status: Response::HTTP_OK); + } +} \ No newline at end of file diff --git a/src/DataFixtures/AppFixtures.php b/src/DataFixtures/AppFixtures.php index f2b8986..358cac9 100644 --- a/src/DataFixtures/AppFixtures.php +++ b/src/DataFixtures/AppFixtures.php @@ -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 - ]); } } diff --git a/src/Doctrine/UserAllowedOrganizationalUnitExtension.php b/src/Doctrine/UserAllowedOrganizationalUnitExtension.php new file mode 100644 index 0000000..54f081e --- /dev/null +++ b/src/Doctrine/UserAllowedOrganizationalUnitExtension.php @@ -0,0 +1,61 @@ +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); + } + } + +} \ No newline at end of file diff --git a/src/Dto/Input/ChangeOrganizationalUnitInput.php b/src/Dto/Input/ChangeOrganizationalUnitInput.php new file mode 100644 index 0000000..71f8cec --- /dev/null +++ b/src/Dto/Input/ChangeOrganizationalUnitInput.php @@ -0,0 +1,22 @@ +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; + } +} \ No newline at end of file diff --git a/src/Dto/Input/HardwareInput.php b/src/Dto/Input/HardwareInput.php new file mode 100644 index 0000000..7674310 --- /dev/null +++ b/src/Dto/Input/HardwareInput.php @@ -0,0 +1,50 @@ +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; + } +} \ No newline at end of file diff --git a/src/Dto/Input/HardwareProfileInput.php b/src/Dto/Input/HardwareProfileInput.php new file mode 100644 index 0000000..e44990e --- /dev/null +++ b/src/Dto/Input/HardwareProfileInput.php @@ -0,0 +1,51 @@ +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; + } +} \ No newline at end of file diff --git a/src/Dto/Input/HardwareTypeInput.php b/src/Dto/Input/HardwareTypeInput.php new file mode 100644 index 0000000..9eb0ae1 --- /dev/null +++ b/src/Dto/Input/HardwareTypeInput.php @@ -0,0 +1,35 @@ +name = $hardwareType->getName(); + } + + public function createOrUpdateEntity(?HardwareType $hardwareType = null): HardwareType + { + if (!$hardwareType) { + $hardwareType = new HardwareType(); + } + + $hardwareType->setName($this->name); + + return $hardwareType; + } + +} \ No newline at end of file diff --git a/src/Dto/Input/ImageInput.php b/src/Dto/Input/ImageInput.php new file mode 100644 index 0000000..d6623ab --- /dev/null +++ b/src/Dto/Input/ImageInput.php @@ -0,0 +1,92 @@ +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; + } +} \ No newline at end of file diff --git a/src/Dto/Input/MenuInput.php b/src/Dto/Input/MenuInput.php new file mode 100644 index 0000000..d09d78e --- /dev/null +++ b/src/Dto/Input/MenuInput.php @@ -0,0 +1,70 @@ +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; + } +} \ No newline at end of file diff --git a/src/Dto/Input/NetworkSettingsInput.php b/src/Dto/Input/NetworkSettingsInput.php new file mode 100644 index 0000000..750f0de --- /dev/null +++ b/src/Dto/Input/NetworkSettingsInput.php @@ -0,0 +1,127 @@ +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; + } +} \ No newline at end of file diff --git a/src/Dto/Input/OperativeSystemInput.php b/src/Dto/Input/OperativeSystemInput.php new file mode 100644 index 0000000..a38d809 --- /dev/null +++ b/src/Dto/Input/OperativeSystemInput.php @@ -0,0 +1,35 @@ +name = $operativeSystem->getName(); + } + + public function createOrUpdateEntity(?OperativeSystem $operativeSystem = null): OperativeSystem + { + if (!$operativeSystem) { + $operativeSystem = new OperativeSystem(); + } + + $operativeSystem->setName($this->name); + + return $operativeSystem; + } + +} \ No newline at end of file diff --git a/src/Dto/Input/OrganizationalUnitInput.php b/src/Dto/Input/OrganizationalUnitInput.php index 53f8d40..7ce2c2b 100644 --- a/src/Dto/Input/OrganizationalUnitInput.php +++ b/src/Dto/Input/OrganizationalUnitInput.php @@ -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; } diff --git a/src/Dto/Input/PartitionInput.php b/src/Dto/Input/PartitionInput.php new file mode 100644 index 0000000..03d633a --- /dev/null +++ b/src/Dto/Input/PartitionInput.php @@ -0,0 +1,92 @@ +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; + } +} \ No newline at end of file diff --git a/src/Dto/Input/SoftwareInput.php b/src/Dto/Input/SoftwareInput.php new file mode 100644 index 0000000..624a94c --- /dev/null +++ b/src/Dto/Input/SoftwareInput.php @@ -0,0 +1,42 @@ +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; + } +} \ No newline at end of file diff --git a/src/Dto/Input/SoftwareProfileInput.php b/src/Dto/Input/SoftwareProfileInput.php new file mode 100644 index 0000000..c803d82 --- /dev/null +++ b/src/Dto/Input/SoftwareProfileInput.php @@ -0,0 +1,51 @@ +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; + } +} \ No newline at end of file diff --git a/src/Dto/Input/UserInput.php b/src/Dto/Input/UserInput.php index 8b37575..5ecc8bb 100644 --- a/src/Dto/Input/UserInput.php +++ b/src/Dto/Input/UserInput.php @@ -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 diff --git a/src/Dto/Output/ClientOutput.php b/src/Dto/Output/ClientOutput.php new file mode 100644 index 0000000..a7b49e3 --- /dev/null +++ b/src/Dto/Output/ClientOutput.php @@ -0,0 +1,82 @@ +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(); + } +} \ No newline at end of file diff --git a/src/Dto/Output/HardwareOutput.php b/src/Dto/Output/HardwareOutput.php new file mode 100644 index 0000000..3823f33 --- /dev/null +++ b/src/Dto/Output/HardwareOutput.php @@ -0,0 +1,39 @@ +name = $hardware->getName(); + $this->description = $hardware->getDescription(); + $this->type = new HardwareTypeOutput($hardware->getType()); + $this->createdAt = $hardware->getCreatedAt(); + $this->createdBy = $hardware->getCreatedBy(); + } +} \ No newline at end of file diff --git a/src/Dto/Output/HardwareProfileOutput.php b/src/Dto/Output/HardwareProfileOutput.php new file mode 100644 index 0000000..128f2c8 --- /dev/null +++ b/src/Dto/Output/HardwareProfileOutput.php @@ -0,0 +1,49 @@ +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(); + } +} \ No newline at end of file diff --git a/src/Dto/Output/HardwareTypeOutput.php b/src/Dto/Output/HardwareTypeOutput.php new file mode 100644 index 0000000..860e86f --- /dev/null +++ b/src/Dto/Output/HardwareTypeOutput.php @@ -0,0 +1,21 @@ +name = $hardwareType->getName(); + } +} \ No newline at end of file diff --git a/src/Dto/Output/ImageOutput.php b/src/Dto/Output/ImageOutput.php new file mode 100644 index 0000000..f14e16a --- /dev/null +++ b/src/Dto/Output/ImageOutput.php @@ -0,0 +1,57 @@ +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()); + } +} \ No newline at end of file diff --git a/src/Dto/Output/MenuOutput.php b/src/Dto/Output/MenuOutput.php new file mode 100644 index 0000000..309fb45 --- /dev/null +++ b/src/Dto/Output/MenuOutput.php @@ -0,0 +1,50 @@ +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(); + } +} \ No newline at end of file diff --git a/src/Dto/Output/NetworkSettingsOutput.php b/src/Dto/Output/NetworkSettingsOutput.php new file mode 100644 index 0000000..9c0b66d --- /dev/null +++ b/src/Dto/Output/NetworkSettingsOutput.php @@ -0,0 +1,88 @@ +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(); + } +} \ No newline at end of file diff --git a/src/Dto/Output/OperativeSystemOutput.php b/src/Dto/Output/OperativeSystemOutput.php new file mode 100644 index 0000000..39987c2 --- /dev/null +++ b/src/Dto/Output/OperativeSystemOutput.php @@ -0,0 +1,21 @@ +name = $operativeSystem->getName(); + } +} \ No newline at end of file diff --git a/src/Dto/Output/OrganizationalUnitOutput.php b/src/Dto/Output/OrganizationalUnitOutput.php index 1b8bf80..a51a5c0 100644 --- a/src/Dto/Output/OrganizationalUnitOutput.php +++ b/src/Dto/Output/OrganizationalUnitOutput.php @@ -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(); } } \ No newline at end of file diff --git a/src/Dto/Output/PartitionOutput.php b/src/Dto/Output/PartitionOutput.php new file mode 100644 index 0000000..f6eaadf --- /dev/null +++ b/src/Dto/Output/PartitionOutput.php @@ -0,0 +1,51 @@ +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; + } +} \ No newline at end of file diff --git a/src/Dto/Output/SoftwareOutput.php b/src/Dto/Output/SoftwareOutput.php new file mode 100644 index 0000000..07a4fee --- /dev/null +++ b/src/Dto/Output/SoftwareOutput.php @@ -0,0 +1,34 @@ +name = $software->getName(); + $this->description = $software->getDescription(); + $this->createdAt = $software->getCreatedAt(); + $this->createdBy = $software->getCreatedBy(); + } +} \ No newline at end of file diff --git a/src/Dto/Output/SoftwareProfileOutput.php b/src/Dto/Output/SoftwareProfileOutput.php new file mode 100644 index 0000000..5dc21e0 --- /dev/null +++ b/src/Dto/Output/SoftwareProfileOutput.php @@ -0,0 +1,49 @@ +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(); + } +} \ No newline at end of file diff --git a/src/Dto/Output/UserGroupOutput.php b/src/Dto/Output/UserGroupOutput.php index 1b1308d..3892d4b 100644 --- a/src/Dto/Output/UserGroupOutput.php +++ b/src/Dto/Output/UserGroupOutput.php @@ -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(); } } \ No newline at end of file diff --git a/src/Dto/Output/UserOutput.php b/src/Dto/Output/UserOutput.php index 5cd4d72..7960699 100644 --- a/src/Dto/Output/UserOutput.php +++ b/src/Dto/Output/UserOutput.php @@ -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(); } } \ No newline at end of file diff --git a/src/Entity/Client.php b/src/Entity/Client.php index 4fa39ea..867fa3c 100644 --- a/src/Entity/Client.php +++ b/src/Entity/Client.php @@ -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 + */ + #[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 + */ + 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; + } } diff --git a/src/Entity/Hardware.php b/src/Entity/Hardware.php new file mode 100644 index 0000000..50545a2 --- /dev/null +++ b/src/Entity/Hardware.php @@ -0,0 +1,89 @@ + + */ + #[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 + */ + 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; + } +} diff --git a/src/Entity/HardwareProfile.php b/src/Entity/HardwareProfile.php new file mode 100644 index 0000000..3538baf --- /dev/null +++ b/src/Entity/HardwareProfile.php @@ -0,0 +1,137 @@ + + */ + #[ORM\ManyToMany(targetEntity: Hardware::class, inversedBy: 'hardwareProfiles')] + private Collection $hardwareCollection; + + /** + * @var Collection + */ + #[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 + */ + 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 + */ + 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; + } +} diff --git a/src/Entity/HardwareType.php b/src/Entity/HardwareType.php new file mode 100644 index 0000000..e0c2260 --- /dev/null +++ b/src/Entity/HardwareType.php @@ -0,0 +1,12 @@ +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; + } +} diff --git a/src/Entity/Menu.php b/src/Entity/Menu.php new file mode 100644 index 0000000..53c123a --- /dev/null +++ b/src/Entity/Menu.php @@ -0,0 +1,130 @@ + + */ + #[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 + */ + 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; + } +} diff --git a/src/Entity/Migration/Aulas.php b/src/Entity/Migration/Aulas.php deleted file mode 100644 index d4179e3..0000000 --- a/src/Entity/Migration/Aulas.php +++ /dev/null @@ -1,753 +0,0 @@ -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; - } -} diff --git a/src/Entity/Migration/Centros.php b/src/Entity/Migration/Centros.php deleted file mode 100644 index 1978a02..0000000 --- a/src/Entity/Migration/Centros.php +++ /dev/null @@ -1,133 +0,0 @@ -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; - } -} diff --git a/src/Entity/Migration/Gruposordenadores.php b/src/Entity/Migration/Gruposordenadores.php deleted file mode 100644 index d2a27b4..0000000 --- a/src/Entity/Migration/Gruposordenadores.php +++ /dev/null @@ -1,133 +0,0 @@ -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; - } -} diff --git a/src/Entity/Migration/Ordenadores.php b/src/Entity/Migration/Ordenadores.php deleted file mode 100644 index 351defe..0000000 --- a/src/Entity/Migration/Ordenadores.php +++ /dev/null @@ -1,663 +0,0 @@ -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; - } -} diff --git a/src/Entity/NetworkSettings.php b/src/Entity/NetworkSettings.php index 7f36461..faf7002 100644 --- a/src/Entity/NetworkSettings.php +++ b/src/Entity/NetworkSettings.php @@ -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 */ - #[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; + } } diff --git a/src/Entity/OperativeSystem.php b/src/Entity/OperativeSystem.php new file mode 100644 index 0000000..1f197fd --- /dev/null +++ b/src/Entity/OperativeSystem.php @@ -0,0 +1,56 @@ + + */ + #[ORM\OneToMany(mappedBy: 'operativeSystem', targetEntity: Partition::class)] + private Collection $partitions; + + public function __construct() + { + parent::__construct(); + $this->partitions = new ArrayCollection(); + } + + /** + * @return Collection + */ + 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; + } +} diff --git a/src/Entity/OperativeSystemType.php b/src/Entity/OperativeSystemType.php new file mode 100644 index 0000000..cb103d1 --- /dev/null +++ b/src/Entity/OperativeSystemType.php @@ -0,0 +1,12 @@ + + */ + #[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 + */ + 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; + } } diff --git a/src/Entity/Partition.php b/src/Entity/Partition.php new file mode 100644 index 0000000..7795315 --- /dev/null +++ b/src/Entity/Partition.php @@ -0,0 +1,147 @@ +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; + } +} diff --git a/src/Entity/Software.php b/src/Entity/Software.php new file mode 100644 index 0000000..1723483 --- /dev/null +++ b/src/Entity/Software.php @@ -0,0 +1,69 @@ + + */ + #[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 + */ + 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; + } +} diff --git a/src/Entity/SoftwareProfile.php b/src/Entity/SoftwareProfile.php new file mode 100644 index 0000000..bc0f968 --- /dev/null +++ b/src/Entity/SoftwareProfile.php @@ -0,0 +1,100 @@ + + */ + #[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 + */ + 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; + } +} diff --git a/src/Entity/User.php b/src/Entity/User.php index 8e6e399..4b821ce 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -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 */ - #[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; diff --git a/src/Entity/UserGroup.php b/src/Entity/UserGroup.php index a017aa9..03cef94 100644 --- a/src/Entity/UserGroup.php +++ b/src/Entity/UserGroup.php @@ -23,7 +23,7 @@ class UserGroup extends AbstractEntity /** * @var Collection */ - #[ORM\ManyToMany(targetEntity: User::class, inversedBy: 'userGroups')] + #[ORM\ManyToMany(targetEntity: User::class, mappedBy: 'userGroups')] private Collection $users; public function __construct() diff --git a/src/Factory/ClientFactory.php b/src/Factory/ClientFactory.php new file mode 100644 index 0000000..56e28da --- /dev/null +++ b/src/Factory/ClientFactory.php @@ -0,0 +1,52 @@ + + */ +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; + } +} diff --git a/src/Factory/HardwareFactory.php b/src/Factory/HardwareFactory.php new file mode 100644 index 0000000..24f68c2 --- /dev/null +++ b/src/Factory/HardwareFactory.php @@ -0,0 +1,61 @@ + + */ +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; + } +} diff --git a/src/Factory/HardwareProfileFactory.php b/src/Factory/HardwareProfileFactory.php new file mode 100644 index 0000000..fe3148b --- /dev/null +++ b/src/Factory/HardwareProfileFactory.php @@ -0,0 +1,59 @@ + + */ +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; + } +} diff --git a/src/Factory/HardwareTypeFactory.php b/src/Factory/HardwareTypeFactory.php new file mode 100644 index 0000000..10788fe --- /dev/null +++ b/src/Factory/HardwareTypeFactory.php @@ -0,0 +1,55 @@ + + */ +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; + } +} diff --git a/src/Factory/ImageFactory.php b/src/Factory/ImageFactory.php new file mode 100644 index 0000000..3a4962d --- /dev/null +++ b/src/Factory/ImageFactory.php @@ -0,0 +1,60 @@ + + */ +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; + } +} diff --git a/src/Factory/MenuFactory.php b/src/Factory/MenuFactory.php new file mode 100644 index 0000000..37f8125 --- /dev/null +++ b/src/Factory/MenuFactory.php @@ -0,0 +1,55 @@ + + */ +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; + } +} diff --git a/src/Factory/OperativeSystemFactory.php b/src/Factory/OperativeSystemFactory.php new file mode 100644 index 0000000..975ee04 --- /dev/null +++ b/src/Factory/OperativeSystemFactory.php @@ -0,0 +1,58 @@ + + */ +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; + } +} diff --git a/src/Factory/OperativeSystemTypeFactory.php b/src/Factory/OperativeSystemTypeFactory.php new file mode 100644 index 0000000..c7d8f32 --- /dev/null +++ b/src/Factory/OperativeSystemTypeFactory.php @@ -0,0 +1,60 @@ + + */ +final class OperativeSystemTypeFactory 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 OperativeSystemType::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(): static + { + return $this + // ->afterInstantiate(function(OperativeSystemType $operativeSystemType): void {}) + ; + } + + protected static function getClass(): string + { + return OperativeSystemType::class; + } +} diff --git a/src/Factory/PartitionFactory.php b/src/Factory/PartitionFactory.php new file mode 100644 index 0000000..bb3d736 --- /dev/null +++ b/src/Factory/PartitionFactory.php @@ -0,0 +1,62 @@ + + */ +final class PartitionFactory 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 Partition::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(), + 'memoryUsage' => self::faker()->randomNumber(), + 'size' => self::faker()->randomNumber(), + 'updatedAt' => self::faker()->dateTime(), + 'operativeSystem' => OperativeSystemFactory::new(), + 'client' => ClientFactory::new(), + ]; + } + + /** + * @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization + */ + protected function initialize(): self + { + return $this// ->afterInstantiate(function(Partition $partition): void {}) + ; + } + + protected static function getClass(): string + { + return Partition::class; + } +} diff --git a/src/Factory/SoftwareFactory.php b/src/Factory/SoftwareFactory.php new file mode 100644 index 0000000..7d59325 --- /dev/null +++ b/src/Factory/SoftwareFactory.php @@ -0,0 +1,60 @@ + + */ +final class SoftwareFactory 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 Software::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(Software $software): void {}) + ; + } + + protected static function getClass(): string + { + return Software::class; + } +} diff --git a/src/Factory/SoftwareProfileFactory.php b/src/Factory/SoftwareProfileFactory.php new file mode 100644 index 0000000..5a05ae4 --- /dev/null +++ b/src/Factory/SoftwareProfileFactory.php @@ -0,0 +1,57 @@ + + */ +final class SoftwareProfileFactory 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(), + 'description' => self::faker()->text(255), + 'updatedAt' => self::faker()->dateTime(), + '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(SoftwareProfile $softwareProfile): void {}) + ; + } + + protected static function getClass(): string + { + return SoftwareProfile::class; + } +} diff --git a/src/Factory/UserFactory.php b/src/Factory/UserFactory.php index d626634..01cca77 100644 --- a/src/Factory/UserFactory.php +++ b/src/Factory/UserFactory.php @@ -14,7 +14,7 @@ use Zenstruck\Foundry\RepositoryProxy; */ final class UserFactory extends ModelFactory { - CONST PLAIN_PASSWORD = '12345678'; + CONST string PLAIN_PASSWORD = '12345678'; public function __construct() { diff --git a/src/Handler/OrganizationalUnitChangeParentHandler.php b/src/Handler/OrganizationalUnitChangeParentHandler.php new file mode 100644 index 0000000..0e1ee64 --- /dev/null +++ b/src/Handler/OrganizationalUnitChangeParentHandler.php @@ -0,0 +1,35 @@ +getParent(); + + if (!$parent) { + return throw new \InvalidArgumentException('The organizational unit has no parent.'); + } + + foreach ($organizationalUnit->getClients() as $client) { + $client->setOrganizationalUnit($parent); + $this->clientRepository->save($client); + } + + $this->organizationalUnitRepository->delete($organizationalUnit); + + return $organizationalUnit; + } +} \ No newline at end of file diff --git a/src/Model/OrganizationalUnitMulticastModes.php b/src/Model/OrganizationalUnitMulticastModes.php new file mode 100644 index 0000000..2317771 --- /dev/null +++ b/src/Model/OrganizationalUnitMulticastModes.php @@ -0,0 +1,29 @@ + 'Half Duplex', + self::FULL_DUPLEX => 'Full Duplex', + ]; + + public static function getMcastModeNames(): array + { + return self::MCAST_MODES; + } + + public static function getMcastType(string $mcastMode): ?string + { + return self::MCAST_MODES[$mcastMode] ?? null; + } + + public static function getMcastModes(): array + { + return array_keys(self::MCAST_MODES); + } +} \ No newline at end of file diff --git a/src/Model/OrganizationalUnitP2PModes.php b/src/Model/OrganizationalUnitP2PModes.php new file mode 100644 index 0000000..49d7c0d --- /dev/null +++ b/src/Model/OrganizationalUnitP2PModes.php @@ -0,0 +1,31 @@ + 'El cliente no comparte mientras descarga la imagen', + self::P2P_MODE_PEER => 'El cliente, mientras descarga la imagen, comparte los datos que ya tenga descargados', + self::P2P_MODE_SEEDER => 'Modo de trabajo en modo distribuido', + ]; + + public static function getP2pModeNames(): array + { + return self::P2P_MODE_NAMES; + } + + public static function getP2pModeName(string $p2pMode): ?string + { + return self::P2P_MODE_NAMES[$p2pMode] ?? null; + } + + public static function getP2pModes(): array + { + return array_keys(self::P2P_MODE_NAMES); + } +} \ No newline at end of file diff --git a/src/Model/OrganizationalUnitTypes.php b/src/Model/OrganizationalUnitTypes.php new file mode 100644 index 0000000..e9ee7c0 --- /dev/null +++ b/src/Model/OrganizationalUnitTypes.php @@ -0,0 +1,33 @@ + 'Unidad Organizativa', + self::CLASSROOMS_GROUP => 'Grupo de aulas', + self::CLASSROOM => 'Aula', + self::CLIENTS_GROUP => 'Grupo de ordenadores', + ]; + + public static function getOrganizationalUnitTypes(): array + { + return self::ORGANIZATIONAL_UNIT_TYPES; + } + + public static function getOrganizationalUnitType(string $organizationalUnit): ?string + { + return self::ORGANIZATIONAL_UNIT_TYPES[$organizationalUnit] ?? null; + } + + public static function getOrganizationalUnitTypeKeys(): array + { + return array_keys(self::ORGANIZATIONAL_UNIT_TYPES); + } +} \ No newline at end of file diff --git a/src/Model/SoftwareTypes.php b/src/Model/SoftwareTypes.php new file mode 100644 index 0000000..afe552a --- /dev/null +++ b/src/Model/SoftwareTypes.php @@ -0,0 +1,31 @@ + 'Sistema Operativo', + self::FILE => 'Fichero', + self::APPLICATION => 'Aplicación', + ]; + + public static function getSoftwareTypes(): array + { + return self::SOFTWARE_TYPES; + } + + public static function getSoftwareType(string $software): ?string + { + return self::SOFTWARE_TYPES[$software] ?? null; + } + + public static function getSoftwareTypeKeys(): array + { + return array_keys(self::SOFTWARE_TYPES); + } +} \ No newline at end of file diff --git a/src/Model/UserGroupPermissions.php b/src/Model/UserGroupPermissions.php index 90a3c9b..26fbb9c 100644 --- a/src/Model/UserGroupPermissions.php +++ b/src/Model/UserGroupPermissions.php @@ -4,14 +4,13 @@ namespace App\Model; final class UserGroupPermissions { - public const ROLE_SUPER_ADMIN = 'ROLE_SUPER_ADMIN'; - public const ROLE_ORGANIZATIONAL_UNIT_ADMIN = 'ROLE_ORGANIZATIONAL_UNIT_ADMIN'; - public const ROLE_ORGANIZATIONAL_UNIT_OPERATOR = 'ROLE_ORGANIZATIONAL_UNIT_OPERATOR'; - public const ROLE_ORGANIZATIONAL_UNIT_MINIMAL = 'ROLE_ORGANIZATIONAL_UNIT_MINIMAL'; + public const string ROLE_SUPER_ADMIN = 'ROLE_SUPER_ADMIN'; + public const string ROLE_ORGANIZATIONAL_UNIT_ADMIN = 'ROLE_ORGANIZATIONAL_UNIT_ADMIN'; + public const string ROLE_ORGANIZATIONAL_UNIT_OPERATOR = 'ROLE_ORGANIZATIONAL_UNIT_OPERATOR'; + public const string ROLE_ORGANIZATIONAL_UNIT_MINIMAL = 'ROLE_ORGANIZATIONAL_UNIT_MINIMAL'; + public const string ROLE_USER = 'ROLE_USER'; - public const ROLE_USER = 'ROLE_USER'; - - private const ROLE_NAMES = [ + private const array ROLE_NAMES = [ self::ROLE_SUPER_ADMIN => 'Super Admin', self::ROLE_ORGANIZATIONAL_UNIT_ADMIN => 'Admin de aulas', self::ROLE_ORGANIZATIONAL_UNIT_OPERATOR => 'Operador de aulas', diff --git a/src/Repository/.gitignore b/src/Repository/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/src/Repository/AbstractRepository.php b/src/Repository/AbstractRepository.php index ff14f0b..2eb3b12 100644 --- a/src/Repository/AbstractRepository.php +++ b/src/Repository/AbstractRepository.php @@ -24,7 +24,7 @@ abstract class AbstractRepository extends ServiceEntityRepository } } - public function delete (AbstractEntity $entity, bool $flush = true): void + public function delete(AbstractEntity $entity, bool $flush = true): void { $this->getEntityManager()->remove($entity); diff --git a/src/Repository/ClientPropertiesRepository.php b/src/Repository/ClientPropertiesRepository.php new file mode 100644 index 0000000..294ecef --- /dev/null +++ b/src/Repository/ClientPropertiesRepository.php @@ -0,0 +1,43 @@ + + */ +class ClientPropertiesRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, ClientProperties::class); + } + + // /** + // * @return ClientProperties[] Returns an array of ClientProperties objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('c') + // ->andWhere('c.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('c.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } + + // public function findOneBySomeField($value): ?ClientProperties + // { + // return $this->createQueryBuilder('c') + // ->andWhere('c.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +} diff --git a/src/Repository/ClientRepository.php b/src/Repository/ClientRepository.php index 81c3e7f..6ec469d 100644 --- a/src/Repository/ClientRepository.php +++ b/src/Repository/ClientRepository.php @@ -9,35 +9,10 @@ use Doctrine\Persistence\ManagerRegistry; /** * @extends ServiceEntityRepository */ -class ClientRepository extends ServiceEntityRepository +class ClientRepository extends AbstractRepository { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, Client::class); } - - // /** - // * @return Client[] Returns an array of Client objects - // */ - // public function findByExampleField($value): array - // { - // return $this->createQueryBuilder('c') - // ->andWhere('c.exampleField = :val') - // ->setParameter('val', $value) - // ->orderBy('c.id', 'ASC') - // ->setMaxResults(10) - // ->getQuery() - // ->getResult() - // ; - // } - - // public function findOneBySomeField($value): ?Client - // { - // return $this->createQueryBuilder('c') - // ->andWhere('c.exampleField = :val') - // ->setParameter('val', $value) - // ->getQuery() - // ->getOneOrNullResult() - // ; - // } } diff --git a/src/Repository/HardwareProfileRepository.php b/src/Repository/HardwareProfileRepository.php new file mode 100644 index 0000000..256a73e --- /dev/null +++ b/src/Repository/HardwareProfileRepository.php @@ -0,0 +1,18 @@ + + */ +class HardwareProfileRepository extends AbstractRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, HardwareProfile::class); + } +} diff --git a/src/Repository/HardwareRepository.php b/src/Repository/HardwareRepository.php new file mode 100644 index 0000000..21a1e2b --- /dev/null +++ b/src/Repository/HardwareRepository.php @@ -0,0 +1,18 @@ + + */ +class HardwareRepository extends AbstractRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Hardware::class); + } +} diff --git a/src/Repository/HardwareTypeRepository.php b/src/Repository/HardwareTypeRepository.php new file mode 100644 index 0000000..004e63d --- /dev/null +++ b/src/Repository/HardwareTypeRepository.php @@ -0,0 +1,18 @@ + + */ +class HardwareTypeRepository extends AbstractRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, HardwareType::class); + } +} diff --git a/src/Repository/ImageRepository.php b/src/Repository/ImageRepository.php new file mode 100644 index 0000000..b20b95b --- /dev/null +++ b/src/Repository/ImageRepository.php @@ -0,0 +1,18 @@ + + */ +class ImageRepository extends AbstractRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Image::class); + } +} diff --git a/src/Repository/MenuRepository.php b/src/Repository/MenuRepository.php new file mode 100644 index 0000000..b23f67d --- /dev/null +++ b/src/Repository/MenuRepository.php @@ -0,0 +1,18 @@ + + */ +class MenuRepository extends AbstractRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Menu::class); + } +} diff --git a/src/Repository/NetworkSettingsRepository.php b/src/Repository/NetworkSettingsRepository.php index 66a3251..0de2908 100644 --- a/src/Repository/NetworkSettingsRepository.php +++ b/src/Repository/NetworkSettingsRepository.php @@ -9,35 +9,10 @@ use Doctrine\Persistence\ManagerRegistry; /** * @extends ServiceEntityRepository */ -class NetworkSettingsRepository extends ServiceEntityRepository +class NetworkSettingsRepository extends AbstractRepository { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, NetworkSettings::class); } - -// /** -// * @return NetworkSettings[] Returns an array of NetworkSettings objects -// */ -// public function findByExampleField($value): array -// { -// return $this->createQueryBuilder('n') -// ->andWhere('n.exampleField = :val') -// ->setParameter('val', $value) -// ->orderBy('n.id', 'ASC') -// ->setMaxResults(10) -// ->getQuery() -// ->getResult() -// ; -// } - -// public function findOneBySomeField($value): ?NetworkSettings -// { -// return $this->createQueryBuilder('n') -// ->andWhere('n.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } } diff --git a/src/Repository/OperativeSystemRepository.php b/src/Repository/OperativeSystemRepository.php new file mode 100644 index 0000000..793093c --- /dev/null +++ b/src/Repository/OperativeSystemRepository.php @@ -0,0 +1,18 @@ + + */ +class OperativeSystemRepository extends AbstractRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, OperativeSystem::class); + } +} diff --git a/src/Repository/OperativeSystemTypeRepository.php b/src/Repository/OperativeSystemTypeRepository.php new file mode 100644 index 0000000..e776e55 --- /dev/null +++ b/src/Repository/OperativeSystemTypeRepository.php @@ -0,0 +1,18 @@ + + */ +class OperativeSystemTypeRepository extends AbstractRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, OperativeSystemType::class); + } +} diff --git a/src/Repository/PartitionRepository.php b/src/Repository/PartitionRepository.php new file mode 100644 index 0000000..e4964b3 --- /dev/null +++ b/src/Repository/PartitionRepository.php @@ -0,0 +1,18 @@ + + */ +class PartitionRepository extends AbstractRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Partition::class); + } +} diff --git a/src/Repository/SoftwareProfileRepository.php b/src/Repository/SoftwareProfileRepository.php new file mode 100644 index 0000000..72fded4 --- /dev/null +++ b/src/Repository/SoftwareProfileRepository.php @@ -0,0 +1,18 @@ + + */ +class SoftwareProfileRepository extends AbstractRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, SoftwareProfile::class); + } +} diff --git a/src/Repository/SoftwareRepository.php b/src/Repository/SoftwareRepository.php new file mode 100644 index 0000000..9b7f49f --- /dev/null +++ b/src/Repository/SoftwareRepository.php @@ -0,0 +1,18 @@ + + */ +class SoftwareRepository extends AbstractRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Software::class); + } +} diff --git a/src/Security/Voter/ClientVoter.php b/src/Security/Voter/ClientVoter.php new file mode 100644 index 0000000..4be0a12 --- /dev/null +++ b/src/Security/Voter/ClientVoter.php @@ -0,0 +1,48 @@ +getUser(); + + + if (!$user instanceof UserInterface) { + return false; + } + + if (in_array(UserGroupPermissions::ROLE_SUPER_ADMIN, $user->getRoles())) { + return true; + } + + if ($attribute === 'CLIENT_VIEW') { + foreach ($user->getAllowedOrganizationalUnits() as $allowedOrganizationalUnit) { + if ($allowedOrganizationalUnit->getId() === $subject->getOrganizationalUnit()->getEntity()->getId()) { + return true; + } + } + } + + return false; + } +} diff --git a/src/Security/Voter/OrganizationalUnitVoter.php b/src/Security/Voter/OrganizationalUnitVoter.php new file mode 100644 index 0000000..2fd3112 --- /dev/null +++ b/src/Security/Voter/OrganizationalUnitVoter.php @@ -0,0 +1,47 @@ +getUser(); + + + if (!$user instanceof UserInterface) { + return false; + } + + if (in_array(UserGroupPermissions::ROLE_SUPER_ADMIN, $user->getRoles())) { + return true; + } + + if ($attribute === 'ORGANIZATIONAL_UNIT_VIEW' ) { + foreach ($user->getAllowedOrganizationalUnits() as $allowedOrganizationalUnit) { + if ($allowedOrganizationalUnit->getId() === $subject->getEntity()->getId()) { + return true; + } + } + } + + return false; + } +} diff --git a/src/Service/ChangeClientNetworkSettingsService.php b/src/Service/ChangeClientNetworkSettingsService.php new file mode 100644 index 0000000..8dac16e --- /dev/null +++ b/src/Service/ChangeClientNetworkSettingsService.php @@ -0,0 +1,18 @@ +updateNetworkSettingsRecursively($organizationalUnit->GetNetworkSettings()); + } +} \ No newline at end of file diff --git a/src/State/Processor/ClientProcessor.php b/src/State/Processor/ClientProcessor.php new file mode 100644 index 0000000..06eab7a --- /dev/null +++ b/src/State/Processor/ClientProcessor.php @@ -0,0 +1,69 @@ +processCreateOrUpdate($data, $operation, $uriVariables, $context); + case $operation instanceof Delete: + return $this->processDelete($data, $operation, $uriVariables, $context); + } + } + + /** + * @throws \Exception + */ + private function processCreateOrUpdate($data, Operation $operation, array $uriVariables = [], array $context = []): ClientOutput + { + if (!($data instanceof ClientInput)) { + throw new \Exception(sprintf('data is not instance of %s', ClientInput::class)); + } + + $entity = null; + if (isset($uriVariables['uuid'])) { + $entity = $this->clientRepository->findOneByUuid($uriVariables['uuid']); + } + + $userGroup = $data->createOrUpdateEntity($entity); + $this->validator->validate($userGroup); + $this->clientRepository->save($userGroup); + + return new ClientOutput($userGroup); + } + + private function processDelete($data, Operation $operation, array $uriVariables = [], array $context = []): null + { + $user = $this->clientRepository->findOneByUuid($uriVariables['uuid']); + $this->clientRepository->delete($user); + + return null; + } +} diff --git a/src/State/Processor/HardwareProcessor.php b/src/State/Processor/HardwareProcessor.php new file mode 100644 index 0000000..ff54e13 --- /dev/null +++ b/src/State/Processor/HardwareProcessor.php @@ -0,0 +1,69 @@ +processCreateOrUpdate($data, $operation, $uriVariables, $context); + case $operation instanceof Delete: + return $this->processDelete($data, $operation, $uriVariables, $context); + } + } + + /** + * @throws \Exception + */ + private function processCreateOrUpdate($data, Operation $operation, array $uriVariables = [], array $context = []): HardwareOutput + { + if (!($data instanceof HardwareInput)) { + throw new \Exception(sprintf('data is not instance of %s', HardwareInput::class)); + } + + $entity = null; + if (isset($uriVariables['uuid'])) { + $entity = $this->hardwareRepository->findOneByUuid($uriVariables['uuid']); + } + + $hardware = $data->createOrUpdateEntity($entity); + $this->validator->validate($hardware); + $this->hardwareRepository->save($hardware); + + return new HardwareOutput($hardware); + } + + private function processDelete($data, Operation $operation, array $uriVariables = [], array $context = []): null + { + $user = $this->hardwareRepository->findOneByUuid($uriVariables['uuid']); + $this->hardwareRepository->delete($user); + + return null; + } +} diff --git a/src/State/Processor/HardwareProfileProcessor.php b/src/State/Processor/HardwareProfileProcessor.php new file mode 100644 index 0000000..f68c3a8 --- /dev/null +++ b/src/State/Processor/HardwareProfileProcessor.php @@ -0,0 +1,69 @@ +processCreateOrUpdate($data, $operation, $uriVariables, $context); + case $operation instanceof Delete: + return $this->processDelete($data, $operation, $uriVariables, $context); + } + } + + /** + * @throws \Exception + */ + private function processCreateOrUpdate($data, Operation $operation, array $uriVariables = [], array $context = []): HardwareProfileOutput + { + if (!($data instanceof HardwareProfileInput)) { + throw new \Exception(sprintf('data is not instance of %s', HardwareProfileInput::class)); + } + + $entity = null; + if (isset($uriVariables['uuid'])) { + $entity = $this->hardwareProfileRepository->findOneByUuid($uriVariables['uuid']); + } + + $hardwareProfile = $data->createOrUpdateEntity($entity); + $this->validator->validate($hardwareProfile); + $this->hardwareProfileRepository->save($hardwareProfile); + + return new HardwareProfileOutput($hardwareProfile); + } + + private function processDelete($data, Operation $operation, array $uriVariables = [], array $context = []): null + { + $user = $this->hardwareProfileRepository->findOneByUuid($uriVariables['uuid']); + $this->hardwareProfileRepository->delete($user); + + return null; + } +} diff --git a/src/State/Processor/HardwareTypeProcessor.php b/src/State/Processor/HardwareTypeProcessor.php new file mode 100644 index 0000000..1da80bb --- /dev/null +++ b/src/State/Processor/HardwareTypeProcessor.php @@ -0,0 +1,77 @@ +processCreateOrUpdate($data, $operation, $uriVariables, $context); + case $operation instanceof Delete: + return $this->processDelete($data, $operation, $uriVariables, $context); + } + } + + /** + * @throws \Exception + */ + private function processCreateOrUpdate($data, Operation $operation, array $uriVariables = [], array $context = []): HardwareTypeOutput + { + if (!($data instanceof HardwareTypeInput)) { + throw new \Exception(sprintf('data is not instance of %s', MenuInput::class)); + } + + $entity = null; + if (isset($uriVariables['uuid'])) { + $entity = $this->hardwareTypeRepository->findOneByUuid($uriVariables['uuid']); + } + + $hardwareType = $data->createOrUpdateEntity($entity); + $this->validator->validate($hardwareType); + $this->hardwareTypeRepository->save($hardwareType); + + return new HardwareTypeOutput($hardwareType); + } + + private function processDelete($data, Operation $operation, array $uriVariables = [], array $context = []): null + { + $user = $this->hardwareTypeRepository->findOneByUuid($uriVariables['uuid']); + $this->hardwareTypeRepository->delete($user); + + return null; + } +} diff --git a/src/State/Processor/ImageProcessor.php b/src/State/Processor/ImageProcessor.php new file mode 100644 index 0000000..833225d --- /dev/null +++ b/src/State/Processor/ImageProcessor.php @@ -0,0 +1,68 @@ +processCreateOrUpdate($data, $operation, $uriVariables, $context); + case $operation instanceof Delete: + return $this->processDelete($data, $operation, $uriVariables, $context); + } + } + + /** + * @throws \Exception + */ + private function processCreateOrUpdate($data, Operation $operation, array $uriVariables = [], array $context = []): ImageOutput + { + if (!($data instanceof ImageInput)) { + throw new \Exception(sprintf('data is not instance of %s', ImageInput::class)); + } + + $entity = null; + if (isset($uriVariables['uuid'])) { + $entity = $this->imageRepository->findOneByUuid($uriVariables['uuid']); + } + + $image = $data->createOrUpdateEntity($entity); + $this->validator->validate($image); + $this->imageRepository->save($image); + + return new ImageOutput($image); + } + + private function processDelete($data, Operation $operation, array $uriVariables = [], array $context = []): null + { + $user = $this->imageRepository->findOneByUuid($uriVariables['uuid']); + $this->imageRepository->delete($user); + + return null; + } +} diff --git a/src/State/Processor/MenuProcessor.php b/src/State/Processor/MenuProcessor.php new file mode 100644 index 0000000..16bda49 --- /dev/null +++ b/src/State/Processor/MenuProcessor.php @@ -0,0 +1,71 @@ +processCreateOrUpdate($data, $operation, $uriVariables, $context); + case $operation instanceof Delete: + return $this->processDelete($data, $operation, $uriVariables, $context); + } + } + + /** + * @throws \Exception + */ + private function processCreateOrUpdate($data, Operation $operation, array $uriVariables = [], array $context = []): MenuOutput + { + if (!($data instanceof MenuInput)) { + throw new \Exception(sprintf('data is not instance of %s', MenuInput::class)); + } + + $entity = null; + if (isset($uriVariables['uuid'])) { + $entity = $this->menuRepository->findOneByUuid($uriVariables['uuid']); + } + + $menu = $data->createOrUpdateEntity($entity); + $this->validator->validate($menu); + $this->menuRepository->save($menu); + + return new MenuOutput($menu); + } + + private function processDelete($data, Operation $operation, array $uriVariables = [], array $context = []): null + { + $user = $this->menuRepository->findOneByUuid($uriVariables['uuid']); + $this->menuRepository->delete($user); + + return null; + } +} diff --git a/src/State/Processor/OperativeSystemProcessor.php b/src/State/Processor/OperativeSystemProcessor.php new file mode 100644 index 0000000..dadd449 --- /dev/null +++ b/src/State/Processor/OperativeSystemProcessor.php @@ -0,0 +1,74 @@ +processCreateOrUpdate($data, $operation, $uriVariables, $context); + case $operation instanceof Delete: + return $this->processDelete($data, $operation, $uriVariables, $context); + } + } + + /** + * @throws \Exception + */ + private function processCreateOrUpdate($data, Operation $operation, array $uriVariables = [], array $context = []): OperativeSystemOutput + { + if (!($data instanceof OperativeSystemInput)) { + throw new \Exception(sprintf('data is not instance of %s', MenuInput::class)); + } + + $entity = null; + if (isset($uriVariables['uuid'])) { + $entity = $this->operativeSystemRepository->findOneByUuid($uriVariables['uuid']); + } + + $operativeSystem = $data->createOrUpdateEntity($entity); + $this->validator->validate($operativeSystem); + $this->operativeSystemRepository->save($operativeSystem); + + return new OperativeSystemOutput($operativeSystem); + } + + private function processDelete($data, Operation $operation, array $uriVariables = [], array $context = []): null + { + $user = $this->operativeSystemRepository->findOneByUuid($uriVariables['uuid']); + $this->operativeSystemRepository->delete($user); + + return null; + } +} diff --git a/src/State/Processor/OrganizationalUnitProcessor.php b/src/State/Processor/OrganizationalUnitProcessor.php index 4dd6aac..41d3974 100644 --- a/src/State/Processor/OrganizationalUnitProcessor.php +++ b/src/State/Processor/OrganizationalUnitProcessor.php @@ -9,15 +9,24 @@ use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Put; use ApiPlatform\State\ProcessorInterface; use ApiPlatform\Validator\ValidatorInterface; +use App\Dto\Input\ChangeOrganizationalUnitInput; +use App\Dto\Input\MenuInput; +use App\Dto\Input\OrganizationalUnitClassroomGroupInput; +use App\Dto\Input\OrganizationalUnitClassroomInput; +use App\Dto\Input\OrganizationalUnitClientGroupInput; use App\Dto\Input\OrganizationalUnitInput; +use App\Dto\Input\OrganizationalUnitRootInput; use App\Dto\Output\OrganizationalUnitOutput; use App\Repository\OrganizationalUnitRepository; +use App\Service\ChangeClientNetworkSettingsService; +use Doctrine\ORM\EntityManagerInterface; class OrganizationalUnitProcessor implements ProcessorInterface { public function __construct( - private readonly OrganizationalUnitRepository $organizationalUnitRepository, - private readonly ValidatorInterface $validator + private readonly OrganizationalUnitRepository $organizationalUnitRepository, + private readonly ValidatorInterface $validator, + private readonly ChangeClientNetworkSettingsService $changeClientNetworkSettingsService, ) { } @@ -42,7 +51,7 @@ class OrganizationalUnitProcessor implements ProcessorInterface */ private function processCreateOrUpdate($data, Operation $operation, array $uriVariables = [], array $context = []): OrganizationalUnitOutput { - if (!($data instanceof OrganizationalUnitOutput)) { + if (!($data instanceof OrganizationalUnitInput)) { throw new \Exception(sprintf('data is not instance of %s', OrganizationalUnitInput::class)); } @@ -52,9 +61,11 @@ class OrganizationalUnitProcessor implements ProcessorInterface } $organizationalUnit = $data->createOrUpdateEntity($entity); - $this->validator->validate($organizationalUnit); + $this->validator->validate($organizationalUnit, ['groups' => ['organizational-unit:write']]); $this->organizationalUnitRepository->save($organizationalUnit); + $this->changeClientNetworkSettingsService->__invoke($organizationalUnit); + return new OrganizationalUnitOutput($organizationalUnit); } diff --git a/src/State/Processor/PartitionProcessor.php b/src/State/Processor/PartitionProcessor.php new file mode 100644 index 0000000..f17affc --- /dev/null +++ b/src/State/Processor/PartitionProcessor.php @@ -0,0 +1,74 @@ +processCreateOrUpdate($data, $operation, $uriVariables, $context); + case $operation instanceof Delete: + return $this->processDelete($data, $operation, $uriVariables, $context); + } + } + + /** + * @throws \Exception + */ + private function processCreateOrUpdate($data, Operation $operation, array $uriVariables = [], array $context = []): PartitionOutput + { + if (!($data instanceof PartitionInput)) { + throw new \Exception(sprintf('data is not instance of %s', PartitionInput::class)); + } + + $entity = null; + if (isset($uriVariables['uuid'])) { + $entity = $this->partitionRepository->findOneByUuid($uriVariables['uuid']); + } + + $partition = $data->createOrUpdateEntity($entity); + $this->validator->validate($partition); + $this->partitionRepository->save($partition); + + return new PartitionOutput($partition); + } + + private function processDelete($data, Operation $operation, array $uriVariables = [], array $context = []): null + { + $user = $this->partitionRepository->findOneByUuid($uriVariables['uuid']); + $this->partitionRepository->delete($user); + + return null; + } +} diff --git a/src/State/Processor/SoftwareProcessor.php b/src/State/Processor/SoftwareProcessor.php new file mode 100644 index 0000000..9109b7b --- /dev/null +++ b/src/State/Processor/SoftwareProcessor.php @@ -0,0 +1,68 @@ +processCreateOrUpdate($data, $operation, $uriVariables, $context); + case $operation instanceof Delete: + return $this->processDelete($data, $operation, $uriVariables, $context); + } + } + + /** + * @throws \Exception + */ + private function processCreateOrUpdate($data, Operation $operation, array $uriVariables = [], array $context = []): SoftwareOutput + { + if (!($data instanceof SoftwareInput)) { + throw new \Exception(sprintf('data is not instance of %s', SoftwareInput::class)); + } + + $entity = null; + if (isset($uriVariables['uuid'])) { + $entity = $this->softwareRepository->findOneByUuid($uriVariables['uuid']); + } + + $software = $data->createOrUpdateEntity($entity); + $this->validator->validate($software); + $this->softwareRepository->save($software); + + return new SoftwareOutput($software); + } + + private function processDelete($data, Operation $operation, array $uriVariables = [], array $context = []): null + { + $user = $this->softwareRepository->findOneByUuid($uriVariables['uuid']); + $this->softwareRepository->delete($user); + + return null; + } +} diff --git a/src/State/Processor/SoftwareProfileProcessor.php b/src/State/Processor/SoftwareProfileProcessor.php new file mode 100644 index 0000000..21bde82 --- /dev/null +++ b/src/State/Processor/SoftwareProfileProcessor.php @@ -0,0 +1,68 @@ +processCreateOrUpdate($data, $operation, $uriVariables, $context); + case $operation instanceof Delete: + return $this->processDelete($data, $operation, $uriVariables, $context); + } + } + + /** + * @throws \Exception + */ + private function processCreateOrUpdate($data, Operation $operation, array $uriVariables = [], array $context = []): SoftwareProfileOutput + { + if (!($data instanceof SoftwareProfileInput)) { + throw new \Exception(sprintf('data is not instance of %s', SoftwareProfileInput::class)); + } + + $entity = null; + if (isset($uriVariables['uuid'])) { + $entity = $this->softwareProfileRepository->findOneByUuid($uriVariables['uuid']); + } + + $softwareProfile = $data->createOrUpdateEntity($entity); + $this->validator->validate($softwareProfile); + $this->softwareProfileRepository->save($softwareProfile); + + return new SoftwareProfileOutput($softwareProfile); + } + + private function processDelete($data, Operation $operation, array $uriVariables = [], array $context = []): null + { + $user = $this->softwareProfileRepository->findOneByUuid($uriVariables['uuid']); + $this->softwareProfileRepository->delete($user); + + return null; + } +} diff --git a/src/State/Provider/ClientProvider.php b/src/State/Provider/ClientProvider.php new file mode 100644 index 0000000..d398a0f --- /dev/null +++ b/src/State/Provider/ClientProvider.php @@ -0,0 +1,71 @@ +provideCollection($operation, $uriVariables, $context); + case $operation instanceof Patch: + case $operation instanceof Put: + return $this->provideInput($operation, $uriVariables, $context); + case $operation instanceof Get: + return $this->provideItem($operation, $uriVariables, $context); + } + } + + private function provideCollection(Operation $operation, array $uriVariables = [], array $context = []): object + { + $paginator = $this->collectionProvider->provide($operation, $uriVariables, $context); + + $items = new \ArrayObject(); + foreach ($paginator->getIterator() as $item){ + $items[] = new ClientOutput($item); + } + + return new TraversablePaginator($items, $paginator->getCurrentPage(), $paginator->getItemsPerPage(), $paginator->getTotalItems()); + } + + public function provideItem(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + if (!$item) { + throw new NotFoundHttpException('Client not found'); + } + + return new ClientOutput($item); + } + + public function provideInput(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + if (isset($uriVariables['uuid'])) { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + return $item !== null ? new ClientInput($item) : null; + } + + return new ClientInput(); + } +} diff --git a/src/State/Provider/HardwareProfileProvider.php b/src/State/Provider/HardwareProfileProvider.php new file mode 100644 index 0000000..553b004 --- /dev/null +++ b/src/State/Provider/HardwareProfileProvider.php @@ -0,0 +1,72 @@ +provideCollection($operation, $uriVariables, $context); + case $operation instanceof Patch: + case $operation instanceof Put: + return $this->provideInput($operation, $uriVariables, $context); + case $operation instanceof Get: + return $this->provideItem($operation, $uriVariables, $context); + } + } + + private function provideCollection(Operation $operation, array $uriVariables = [], array $context = []): object + { + $paginator = $this->collectionProvider->provide($operation, $uriVariables, $context); + + $items = new \ArrayObject(); + foreach ($paginator->getIterator() as $item){ + $items[] = new HardwareProfileOutput($item); + } + + return new TraversablePaginator($items, $paginator->getCurrentPage(), $paginator->getItemsPerPage(), $paginator->getTotalItems()); + } + + public function provideItem(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + if (!$item) { + throw new NotFoundHttpException('Hardware profile not found'); + } + + return new HardwareProfileOutput($item); + } + + public function provideInput(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + if (isset($uriVariables['uuid'])) { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + return $item !== null ? new HardwareProfileInput($item) : null; + } + + return new HardwareProfileInput(); + } +} diff --git a/src/State/Provider/HardwareProvider.php b/src/State/Provider/HardwareProvider.php new file mode 100644 index 0000000..93c91af --- /dev/null +++ b/src/State/Provider/HardwareProvider.php @@ -0,0 +1,71 @@ +provideCollection($operation, $uriVariables, $context); + case $operation instanceof Patch: + case $operation instanceof Put: + return $this->provideInput($operation, $uriVariables, $context); + case $operation instanceof Get: + return $this->provideItem($operation, $uriVariables, $context); + } + } + + private function provideCollection(Operation $operation, array $uriVariables = [], array $context = []): object + { + $paginator = $this->collectionProvider->provide($operation, $uriVariables, $context); + + $items = new \ArrayObject(); + foreach ($paginator->getIterator() as $item){ + $items[] = new HardwareOutput($item); + } + + return new TraversablePaginator($items, $paginator->getCurrentPage(), $paginator->getItemsPerPage(), $paginator->getTotalItems()); + } + + public function provideItem(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + if (!$item) { + throw new NotFoundHttpException('Hardware not found'); + } + + return new HardwareOutput($item); + } + + public function provideInput(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + if (isset($uriVariables['uuid'])) { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + return $item !== null ? new HardwareInput($item) : null; + } + + return new HardwareInput(); + } +} diff --git a/src/State/Provider/HardwareTypeProvider.php b/src/State/Provider/HardwareTypeProvider.php new file mode 100644 index 0000000..4a5835b --- /dev/null +++ b/src/State/Provider/HardwareTypeProvider.php @@ -0,0 +1,71 @@ +provideCollection($operation, $uriVariables, $context); + case $operation instanceof Patch: + case $operation instanceof Put: + return $this->provideInput($operation, $uriVariables, $context); + case $operation instanceof Get: + return $this->provideItem($operation, $uriVariables, $context); + } + } + + private function provideCollection(Operation $operation, array $uriVariables = [], array $context = []): object + { + $paginator = $this->collectionProvider->provide($operation, $uriVariables, $context); + + $items = new \ArrayObject(); + foreach ($paginator->getIterator() as $item){ + $items[] = new HardwareTypeOutput($item); + } + + return new TraversablePaginator($items, $paginator->getCurrentPage(), $paginator->getItemsPerPage(), $paginator->getTotalItems()); + } + + public function provideItem(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + if (!$item) { + throw new NotFoundHttpException('hardware type not found'); + } + + return new HardwareTypeOutput($item); + } + + public function provideInput(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + if (isset($uriVariables['uuid'])) { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + return $item !== null ? new HardwareTypeInput($item) : null; + } + + return new HardwareTypeInput(); + } +} diff --git a/src/State/Provider/ImageProvider.php b/src/State/Provider/ImageProvider.php new file mode 100644 index 0000000..d807b4a --- /dev/null +++ b/src/State/Provider/ImageProvider.php @@ -0,0 +1,71 @@ +provideCollection($operation, $uriVariables, $context); + case $operation instanceof Patch: + case $operation instanceof Put: + return $this->provideInput($operation, $uriVariables, $context); + case $operation instanceof Get: + return $this->provideItem($operation, $uriVariables, $context); + } + } + + private function provideCollection(Operation $operation, array $uriVariables = [], array $context = []): object + { + $paginator = $this->collectionProvider->provide($operation, $uriVariables, $context); + + $items = new \ArrayObject(); + foreach ($paginator->getIterator() as $item){ + $items[] = new ImageOutput($item); + } + + return new TraversablePaginator($items, $paginator->getCurrentPage(), $paginator->getItemsPerPage(), $paginator->getTotalItems()); + } + + public function provideItem(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + if (!$item) { + throw new NotFoundHttpException('Menu not found'); + } + + return new ImageOutput($item); + } + + public function provideInput(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + if (isset($uriVariables['uuid'])) { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + return $item !== null ? new ImageInput($item) : null; + } + + return new ImageInput(); + } +} diff --git a/src/State/Provider/MenuProvider.php b/src/State/Provider/MenuProvider.php new file mode 100644 index 0000000..f82cbe6 --- /dev/null +++ b/src/State/Provider/MenuProvider.php @@ -0,0 +1,71 @@ +provideCollection($operation, $uriVariables, $context); + case $operation instanceof Patch: + case $operation instanceof Put: + return $this->provideInput($operation, $uriVariables, $context); + case $operation instanceof Get: + return $this->provideItem($operation, $uriVariables, $context); + } + } + + private function provideCollection(Operation $operation, array $uriVariables = [], array $context = []): object + { + $paginator = $this->collectionProvider->provide($operation, $uriVariables, $context); + + $items = new \ArrayObject(); + foreach ($paginator->getIterator() as $item){ + $items[] = new MenuOutput($item); + } + + return new TraversablePaginator($items, $paginator->getCurrentPage(), $paginator->getItemsPerPage(), $paginator->getTotalItems()); + } + + public function provideItem(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + if (!$item) { + throw new NotFoundHttpException('Menu not found'); + } + + return new MenuOutput($item); + } + + public function provideInput(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + if (isset($uriVariables['uuid'])) { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + return $item !== null ? new MenuInput($item) : null; + } + + return new MenuInput(); + } +} diff --git a/src/State/Provider/OperativeSystemProvider.php b/src/State/Provider/OperativeSystemProvider.php new file mode 100644 index 0000000..9245913 --- /dev/null +++ b/src/State/Provider/OperativeSystemProvider.php @@ -0,0 +1,71 @@ +provideCollection($operation, $uriVariables, $context); + case $operation instanceof Patch: + case $operation instanceof Put: + return $this->provideInput($operation, $uriVariables, $context); + case $operation instanceof Get: + return $this->provideItem($operation, $uriVariables, $context); + } + } + + private function provideCollection(Operation $operation, array $uriVariables = [], array $context = []): object + { + $paginator = $this->collectionProvider->provide($operation, $uriVariables, $context); + + $items = new \ArrayObject(); + foreach ($paginator->getIterator() as $item){ + $items[] = new OperativeSystemOutput($item); + } + + return new TraversablePaginator($items, $paginator->getCurrentPage(), $paginator->getItemsPerPage(), $paginator->getTotalItems()); + } + + public function provideItem(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + if (!$item) { + throw new NotFoundHttpException('Operative system not found'); + } + + return new OperativeSystemOutput($item); + } + + public function provideInput(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + if (isset($uriVariables['uuid'])) { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + return $item !== null ? new OperativeSystemInput($item) : null; + } + + return new OperativeSystemInput(); + } +} diff --git a/src/State/Provider/OrganizationalUnitProvider.php b/src/State/Provider/OrganizationalUnitProvider.php index 83d5735..7475e68 100644 --- a/src/State/Provider/OrganizationalUnitProvider.php +++ b/src/State/Provider/OrganizationalUnitProvider.php @@ -9,15 +9,16 @@ use ApiPlatform\Metadata\Patch; use ApiPlatform\Metadata\Put; use ApiPlatform\State\Pagination\TraversablePaginator; use ApiPlatform\State\ProviderInterface; -use App\Dto\Input\UserGroupInput; +use App\Dto\Input\OrganizationalUnitInput; use App\Dto\Output\OrganizationalUnitOutput; +use App\Entity\OrganizationalUnit; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -class OrganizationalUnitProvider implements ProviderInterface +readonly class OrganizationalUnitProvider implements ProviderInterface { public function __construct( - private readonly ProviderInterface $collectionProvider, - private readonly ProviderInterface $itemProvider + private ProviderInterface $collectionProvider, + private ProviderInterface $itemProvider ) { } @@ -41,7 +42,7 @@ class OrganizationalUnitProvider implements ProviderInterface $items = new \ArrayObject(); foreach ($paginator->getIterator() as $item){ - $items[] = new OrganizationalUnitOutput($item); + $items[] = new OrganizationalUnitOutput($item, $context); } return new TraversablePaginator($items, $paginator->getCurrentPage(), $paginator->getItemsPerPage(), $paginator->getTotalItems()); @@ -55,7 +56,7 @@ class OrganizationalUnitProvider implements ProviderInterface throw new NotFoundHttpException('Organizational unit not found'); } - return new OrganizationalUnitOutput($item); + return new OrganizationalUnitOutput($item, $context); } public function provideInput(Operation $operation, array $uriVariables = [], array $context = []): object|array|null @@ -63,9 +64,9 @@ class OrganizationalUnitProvider implements ProviderInterface if (isset($uriVariables['uuid'])) { $item = $this->itemProvider->provide($operation, $uriVariables, $context); - return $item !== null ? new UserGroupInput($item) : null; + return $item !== null ? new OrganizationalUnitInput($item) : null; } - return new UserGroupInput(); + return new OrganizationalUnitInput(); } } diff --git a/src/State/Provider/PartitionProvider.php b/src/State/Provider/PartitionProvider.php new file mode 100644 index 0000000..f4cfb17 --- /dev/null +++ b/src/State/Provider/PartitionProvider.php @@ -0,0 +1,71 @@ +provideCollection($operation, $uriVariables, $context); + case $operation instanceof Patch: + case $operation instanceof Put: + return $this->provideInput($operation, $uriVariables, $context); + case $operation instanceof Get: + return $this->provideItem($operation, $uriVariables, $context); + } + } + + private function provideCollection(Operation $operation, array $uriVariables = [], array $context = []): object + { + $paginator = $this->collectionProvider->provide($operation, $uriVariables, $context); + + $items = new \ArrayObject(); + foreach ($paginator->getIterator() as $item){ + $items[] = new PartitionOutput($item); + } + + return new TraversablePaginator($items, $paginator->getCurrentPage(), $paginator->getItemsPerPage(), $paginator->getTotalItems()); + } + + public function provideItem(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + if (!$item) { + throw new NotFoundHttpException('Partition not found'); + } + + return new PartitionOutput($item); + } + + public function provideInput(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + if (isset($uriVariables['uuid'])) { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + return $item !== null ? new PartitionInput($item) : null; + } + + return new PartitionInput(); + } +} diff --git a/src/State/Provider/SoftwareProfileProvider.php b/src/State/Provider/SoftwareProfileProvider.php new file mode 100644 index 0000000..94f9aed --- /dev/null +++ b/src/State/Provider/SoftwareProfileProvider.php @@ -0,0 +1,71 @@ +provideCollection($operation, $uriVariables, $context); + case $operation instanceof Patch: + case $operation instanceof Put: + return $this->provideInput($operation, $uriVariables, $context); + case $operation instanceof Get: + return $this->provideItem($operation, $uriVariables, $context); + } + } + + private function provideCollection(Operation $operation, array $uriVariables = [], array $context = []): object + { + $paginator = $this->collectionProvider->provide($operation, $uriVariables, $context); + + $items = new \ArrayObject(); + foreach ($paginator->getIterator() as $item){ + $items[] = new SoftwareProfileInput($item); + } + + return new TraversablePaginator($items, $paginator->getCurrentPage(), $paginator->getItemsPerPage(), $paginator->getTotalItems()); + } + + public function provideItem(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + if (!$item) { + throw new NotFoundHttpException('Software profile not found'); + } + + return new SoftwareProfileOutput($item); + } + + public function provideInput(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + if (isset($uriVariables['uuid'])) { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + return $item !== null ? new SoftwareProfileInput($item) : null; + } + + return new SoftwareProfileInput(); + } +} diff --git a/src/State/Provider/SoftwareProvider.php b/src/State/Provider/SoftwareProvider.php new file mode 100644 index 0000000..9459b09 --- /dev/null +++ b/src/State/Provider/SoftwareProvider.php @@ -0,0 +1,71 @@ +provideCollection($operation, $uriVariables, $context); + case $operation instanceof Patch: + case $operation instanceof Put: + return $this->provideInput($operation, $uriVariables, $context); + case $operation instanceof Get: + return $this->provideItem($operation, $uriVariables, $context); + } + } + + private function provideCollection(Operation $operation, array $uriVariables = [], array $context = []): object + { + $paginator = $this->collectionProvider->provide($operation, $uriVariables, $context); + + $items = new \ArrayObject(); + foreach ($paginator->getIterator() as $item){ + $items[] = new SoftwareOutput($item); + } + + return new TraversablePaginator($items, $paginator->getCurrentPage(), $paginator->getItemsPerPage(), $paginator->getTotalItems()); + } + + public function provideItem(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + if (!$item) { + throw new NotFoundHttpException('Software not found'); + } + + return new SoftwareOutput($item); + } + + public function provideInput(Operation $operation, array $uriVariables = [], array $context = []): object|array|null + { + if (isset($uriVariables['uuid'])) { + $item = $this->itemProvider->provide($operation, $uriVariables, $context); + + return $item !== null ? new SoftwareInput($item) : null; + } + + return new SoftwareInput(); + } +} diff --git a/src/State/Provider/UserProvider.php b/src/State/Provider/UserProvider.php index a850ef7..5ef6eda 100644 --- a/src/State/Provider/UserProvider.php +++ b/src/State/Provider/UserProvider.php @@ -30,7 +30,7 @@ class UserProvider implements ProviderInterface return $this->provideCollection($operation, $uriVariables, $context); case $operation instanceof Patch: case $operation instanceof Put: - return $this->provideInput($operation, $uriVariables, $context); + return $this->provideInput($operation, $uriVariables, $context); case $operation instanceof Get: return $this->provideItem($operation, $uriVariables, $context); } diff --git a/src/Validator/Constraints/OrganizationalUnitMulticastMode.php b/src/Validator/Constraints/OrganizationalUnitMulticastMode.php new file mode 100644 index 0000000..6121b39 --- /dev/null +++ b/src/Validator/Constraints/OrganizationalUnitMulticastMode.php @@ -0,0 +1,27 @@ +modes = OrganizationalUnitMulticastModes::getMcastModes(); + $this->message = sprintf( + 'The multicast mode is not valid. Please use one of the following: %s', + implode(', ', $this->modes) + ); + } + + +} \ No newline at end of file diff --git a/src/Validator/Constraints/OrganizationalUnitMulticastModeValidator.php b/src/Validator/Constraints/OrganizationalUnitMulticastModeValidator.php new file mode 100644 index 0000000..2d6f2ac --- /dev/null +++ b/src/Validator/Constraints/OrganizationalUnitMulticastModeValidator.php @@ -0,0 +1,23 @@ +context->buildViolation($constraint->message)->addViolation(); + } + } +} \ No newline at end of file diff --git a/src/Validator/Constraints/OrganizationalUnitMulticastPort.php b/src/Validator/Constraints/OrganizationalUnitMulticastPort.php new file mode 100644 index 0000000..2d0a0ef --- /dev/null +++ b/src/Validator/Constraints/OrganizationalUnitMulticastPort.php @@ -0,0 +1,19 @@ +message = 'The multicast port is not valid. Please use a number between 9000 and 9050'; + } +} \ No newline at end of file diff --git a/src/Validator/Constraints/OrganizationalUnitMulticastPortValidator.php b/src/Validator/Constraints/OrganizationalUnitMulticastPortValidator.php new file mode 100644 index 0000000..6baabda --- /dev/null +++ b/src/Validator/Constraints/OrganizationalUnitMulticastPortValidator.php @@ -0,0 +1,26 @@ +context->buildViolation($constraint->message)->addViolation(); + return; + } + } +} \ No newline at end of file diff --git a/src/Validator/Constraints/OrganizationalUnitP2PMode.php b/src/Validator/Constraints/OrganizationalUnitP2PMode.php new file mode 100644 index 0000000..45a8663 --- /dev/null +++ b/src/Validator/Constraints/OrganizationalUnitP2PMode.php @@ -0,0 +1,27 @@ +modes = OrganizationalUnitP2PModes::getP2pModes(); + $this->message = sprintf( + 'The p2p mode is not valid. Please use one of the following: %s', + implode(', ', $this->modes) + ); + } + + +} \ No newline at end of file diff --git a/src/Validator/Constraints/OrganizationalUnitP2PModeValidator.php b/src/Validator/Constraints/OrganizationalUnitP2PModeValidator.php new file mode 100644 index 0000000..6138146 --- /dev/null +++ b/src/Validator/Constraints/OrganizationalUnitP2PModeValidator.php @@ -0,0 +1,22 @@ +context->buildViolation($constraint->message)->addViolation(); + } + } +} \ No newline at end of file diff --git a/src/Validator/Constraints/OrganizationalUnitParent.php b/src/Validator/Constraints/OrganizationalUnitParent.php new file mode 100644 index 0000000..7950ac7 --- /dev/null +++ b/src/Validator/Constraints/OrganizationalUnitParent.php @@ -0,0 +1,24 @@ +message = 'Only the root organizational unit can not have a parent.'; + } + + public function getTargets(): array|string + { + return parent::CLASS_CONSTRAINT; + } +} \ No newline at end of file diff --git a/src/Validator/Constraints/OrganizationalUnitParentValidator.php b/src/Validator/Constraints/OrganizationalUnitParentValidator.php new file mode 100644 index 0000000..dccef59 --- /dev/null +++ b/src/Validator/Constraints/OrganizationalUnitParentValidator.php @@ -0,0 +1,25 @@ +parent && in_array($value->type, [OrganizationalUnitTypes::CLASSROOMS_GROUP, OrganizationalUnitTypes::CLASSROOM, OrganizationalUnitTypes::CLIENTS_GROUP])) { + $this->context->buildViolation($constraint->message)->addViolation(); + return; + } + } +} \ No newline at end of file diff --git a/src/Validator/Constraints/OrganizationalUnitType.php b/src/Validator/Constraints/OrganizationalUnitType.php new file mode 100644 index 0000000..f412677 --- /dev/null +++ b/src/Validator/Constraints/OrganizationalUnitType.php @@ -0,0 +1,28 @@ +types = OrganizationalUnitTypes::getOrganizationalUnitTypeKeys(); + $this->message = sprintf( + 'The organizational unit type is not valid. Please use one of the following: %s', + implode(', ', $this->types) + ); + } + + +} \ No newline at end of file diff --git a/src/Validator/Constraints/OrganizationalUnitTypeValidator.php b/src/Validator/Constraints/OrganizationalUnitTypeValidator.php new file mode 100644 index 0000000..ded0059 --- /dev/null +++ b/src/Validator/Constraints/OrganizationalUnitTypeValidator.php @@ -0,0 +1,23 @@ +context->buildViolation($constraint->message)->addViolation(); + } + } +} \ No newline at end of file diff --git a/swagger-assets/img_bbdd.png b/swagger-assets/img_bbdd.png new file mode 100644 index 0000000..ce55b51 Binary files /dev/null and b/swagger-assets/img_bbdd.png differ diff --git a/swagger-assets/ogCore.postman_collection.zip b/swagger-assets/ogCore.postman_collection.zip new file mode 100644 index 0000000..d4b1e5a Binary files /dev/null and b/swagger-assets/ogCore.postman_collection.zip differ diff --git a/symfony.lock b/symfony.lock index 8640694..d9f1015 100644 --- a/symfony.lock +++ b/symfony.lock @@ -14,24 +14,21 @@ ] }, "dama/doctrine-test-bundle": { - "version": "8.1", + "version": "8.2", "recipe": { "repo": "github.com/symfony/recipes-contrib", "branch": "main", "version": "7.2", "ref": "896306d79d4ee143af9eadf9b09fd34a8c391b70" - }, - "files": [ - "config/packages/dama_doctrine_test_bundle.yaml" - ] + } }, "doctrine/doctrine-bundle": { "version": "2.12", "recipe": { "repo": "github.com/symfony/recipes", "branch": "main", - "version": "2.12", - "ref": "7b1b0b637b337f6beb895589948cd119da705524" + "version": "2.10", + "ref": "c170ded8fc587d6bd670550c43dafcf093762245" }, "files": [ "config/packages/doctrine.yaml", @@ -71,12 +68,7 @@ "branch": "main", "version": "1.0", "ref": "2390b4ed5c195e0b3f6dea45221f3b7c0af523a0" - }, - "files": [ - "config/packages/gesdinet_jwt_refresh_token.yaml", - "config/routes/gesdinet_jwt_refresh_token.yaml", - "src/Entity/RefreshToken.php" - ] + } }, "lexik/jwt-authentication-bundle": { "version": "3.0", @@ -117,28 +109,22 @@ ] }, "ramsey/uuid-doctrine": { - "version": "2.0", + "version": "2.1", "recipe": { "repo": "github.com/symfony/recipes-contrib", "branch": "main", "version": "1.3", "ref": "471aed0fbf5620b8d7f92b7a5ebbbf6c0945c27a" - }, - "files": [ - "config/packages/ramsey_uuid_doctrine.yaml" - ] + } }, "stof/doctrine-extensions-bundle": { - "version": "1.10", + "version": "1.11", "recipe": { "repo": "github.com/symfony/recipes-contrib", "branch": "main", "version": "1.2", "ref": "e805aba9eff5372e2d149a9ff56566769e22819d" - }, - "files": [ - "config/packages/stof_doctrine_extensions.yaml" - ] + } }, "symfony/console": { "version": "6.4", @@ -184,7 +170,7 @@ ] }, "symfony/maker-bundle": { - "version": "1.59", + "version": "1.60", "recipe": { "repo": "github.com/symfony/recipes", "branch": "main", @@ -193,7 +179,7 @@ } }, "symfony/phpunit-bridge": { - "version": "7.0", + "version": "7.1", "recipe": { "repo": "github.com/symfony/recipes", "branch": "main", @@ -272,7 +258,7 @@ ] }, "zenstruck/foundry": { - "version": "1.37", + "version": "1.38", "recipe": { "repo": "github.com/symfony/recipes", "branch": "main", diff --git a/tests/Functional/AbstractTest.php b/tests/Functional/AbstractTest.php index 956517f..089d7cc 100644 --- a/tests/Functional/AbstractTest.php +++ b/tests/Functional/AbstractTest.php @@ -4,7 +4,6 @@ namespace Functional; use ApiPlatform\Symfony\Bundle\Test\ApiTestCase; use ApiPlatform\Symfony\Bundle\Test\Client; -use App\Factory\UserFactory; use Faker\Factory; use Faker\Generator; use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; diff --git a/tests/Functional/ClientTest.php b/tests/Functional/ClientTest.php new file mode 100644 index 0000000..82d8055 --- /dev/null +++ b/tests/Functional/ClientTest.php @@ -0,0 +1,145 @@ + self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + ClientFactory::createMany(10); + + $this->createClientWithCredentials()->request('GET', '/clients'); + $this->assertResponseStatusCodeSame(Response::HTTP_OK); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/Client', + '@id' => '/clients', + '@type' => 'hydra:Collection', + 'hydra:totalItems' => 10, + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testCreateClient(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + OrganizationalUnitFactory::createOne(['type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT]); + $ouIri = $this->findIriBy(OrganizationalUnit::class, ['type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT]); + + HardwareProfileFactory::createOne(['description' => self::HW_PROFILE]); + $hpIri = $this->findIriBy(HardwareProfile::class, ['description' => self::HW_PROFILE]); + + $this->createClientWithCredentials()->request('POST', '/clients',['json' => [ + 'name' => self::CLIENT_CREATE, + 'organizationalUnit' => $ouIri, + 'hardwareProfile' => $hpIri, + 'serialNumber' => '123abc', + ]]); + + $this->assertResponseStatusCodeSame(201); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/ClientOutput', + '@type' => 'Client', + 'name' => self::CLIENT_CREATE, + 'serialNumber' => '123abc', + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testUpdateClient(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + $ou = OrganizationalUnitFactory::createOne(['type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT]); + $hp = HardwareProfileFactory::createOne(['description' => self::HW_PROFILE]); + + ClientFactory::createOne(['name' => self::CLIENT_UPDATE, 'serialNumber' => '123abc', 'organizationalUnit' => $ou, 'hardwareProfile' => $hp]); + $iri = $this->findIriBy(Client::class, ['name' => self::CLIENT_UPDATE]); + + $this->createClientWithCredentials()->request('PUT', $iri, ['json' => [ + 'name' => self::CLIENT_UPDATE, + 'serialNumber' => '987zyx' + ]]); + + $this->assertResponseIsSuccessful(); + $this->assertJsonContains([ + '@id' => $iri, + 'name' => self::CLIENT_UPDATE, + 'serialNumber' => '987zyx' + ]); + } + + /** + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + */ + public function testDeleteClient(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + $ou = OrganizationalUnitFactory::createOne(['type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT]); + $hp = HardwareProfileFactory::createOne(['description' => self::HW_PROFILE]); + + ClientFactory::createOne(['name' => self::CLIENT_DELETE, 'serialNumber' => '123abc', 'organizationalUnit' => $ou, 'hardwareProfile' => $hp]); + $iri = $this->findIriBy(Client::class, ['name' => self::CLIENT_DELETE]); + + $this->createClientWithCredentials()->request('DELETE', $iri); + $this->assertResponseStatusCodeSame(204); + $this->assertNull( + static::getContainer()->get('doctrine')->getRepository(Client::class)->findOneBy(['name' => self::CLIENT_DELETE]) + ); + } +} \ No newline at end of file diff --git a/tests/Functional/HardwareProfileTest.php b/tests/Functional/HardwareProfileTest.php new file mode 100644 index 0000000..6d710b8 --- /dev/null +++ b/tests/Functional/HardwareProfileTest.php @@ -0,0 +1,124 @@ + self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + HardwareProfileFactory::createMany(10); + + $this->createClientWithCredentials()->request('GET', '/hardware-profiles'); + $this->assertResponseStatusCodeSame(Response::HTTP_OK); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/HardwareProfile', + '@id' => '/hardware-profiles', + '@type' => 'hydra:Collection', + 'hydra:totalItems' => 10, + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testCreateHardwareProfile(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + OrganizationalUnitFactory::createOne(['type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT]); + $ouIri = $this->findIriBy(OrganizationalUnit::class, ['type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT]); + + $this->createClientWithCredentials()->request('POST', '/hardware-profiles',['json' => [ + 'description' => self::HW_PROFILE_CREATE, + 'organizationalUnit' => $ouIri + ]]); + + $this->assertResponseStatusCodeSame(201); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/HardwareProfileOutput', + '@type' => 'HardwareProfile', + 'description' => self::HW_PROFILE_CREATE + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testUpdateHardwareProfile(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + HardwareProfileFactory::createOne(['description' => self::HW_PROFILE_CREATE]); + $iri = $this->findIriBy(HardwareProfile::class, ['description' => self::HW_PROFILE_CREATE]); + + $this->createClientWithCredentials()->request('PUT', $iri, ['json' => [ + 'description' => self::HW_PROFILE_UPDATE, + ]]); + + $this->assertResponseIsSuccessful(); + $this->assertJsonContains([ + '@id' => $iri, + 'description' => self::HW_PROFILE_UPDATE, + ]); + } + + /** + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + */ + public function testDeleteHardwareProfile(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + HardwareProfileFactory::createOne(['description' => self::HW_PROFILE_DELETE]); + $iri = $this->findIriBy(HardwareProfile::class, ['description' => self::HW_PROFILE_DELETE]); + + $this->createClientWithCredentials()->request('DELETE', $iri); + $this->assertResponseStatusCodeSame(204); + $this->assertNull( + static::getContainer()->get('doctrine')->getRepository(HardwareProfile::class)->findOneBy(['description' => self::HW_PROFILE_DELETE]) + ); + } +} \ No newline at end of file diff --git a/tests/Functional/HardwareTest.php b/tests/Functional/HardwareTest.php new file mode 100644 index 0000000..1726ae7 --- /dev/null +++ b/tests/Functional/HardwareTest.php @@ -0,0 +1,125 @@ + self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + HardwareFactory::createMany(10); + + $this->createClientWithCredentials()->request('GET', '/hardware'); + $this->assertResponseStatusCodeSame(Response::HTTP_OK); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/Hardware', + '@id' => '/hardware', + '@type' => 'hydra:Collection', + 'hydra:totalItems' => 10, + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testCreateHardware(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + HardwareTypeFactory::createOne(['name' => self::HW_TYPE]); + $hwIri = $this->findIriBy(HardwareType::class, ['name' => self::HW_TYPE]); + + $this->createClientWithCredentials()->request('POST', '/hardware',['json' => [ + 'name' => self::HW_CREATE, + 'type' => $hwIri + ]]); + + $this->assertResponseStatusCodeSame(201); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/HardwareOutput', + '@type' => 'Hardware', + 'name' => self::HW_CREATE + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testUpdateHardware(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + HardwareFactory::createOne(['name' => self::HW_CREATE]); + $iri = $this->findIriBy(Hardware::class, ['name' => self::HW_CREATE]); + + $this->createClientWithCredentials()->request('PUT', $iri, ['json' => [ + 'name' => self::HW_UPDATE, + ]]); + + $this->assertResponseIsSuccessful(); + $this->assertJsonContains([ + '@id' => $iri, + 'name' => self::HW_UPDATE, + ]); + } + + /** + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + */ + public function testDeleteHardware(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + HardwareFactory::createOne(['name' => self::HW_DELETE]); + $iri = $this->findIriBy(Hardware::class, ['name' => self::HW_DELETE]); + + $this->createClientWithCredentials()->request('DELETE', $iri); + $this->assertResponseStatusCodeSame(204); + $this->assertNull( + static::getContainer()->get('doctrine')->getRepository(Hardware::class)->findOneBy(['name' => self::HW_DELETE]) + ); + } +} \ No newline at end of file diff --git a/tests/Functional/HardwareTypeTest.php b/tests/Functional/HardwareTypeTest.php new file mode 100644 index 0000000..21526bc --- /dev/null +++ b/tests/Functional/HardwareTypeTest.php @@ -0,0 +1,117 @@ + self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + HardwareTypeFactory::createMany(10); + + $this->createClientWithCredentials()->request('GET', '/hardware-types'); + $this->assertResponseStatusCodeSame(Response::HTTP_OK); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/HardwareType', + '@id' => '/hardware-types', + '@type' => 'hydra:Collection', + 'hydra:totalItems' => 10, + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testCreateHardwareType(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + $this->createClientWithCredentials()->request('POST', '/hardware-types',['json' => [ + 'name' => self::HW_TYPE_CREATE, + ]]); + + $this->assertResponseStatusCodeSame(201); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/HardwareTypeOutput', + '@type' => 'HardwareType', + 'name' => self::HW_TYPE_CREATE + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testUpdateHardwareType(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + HardwareTypeFactory::createOne(['name' => self::HW_TYPE_CREATE]); + $iri = $this->findIriBy(HardwareType::class, ['name' => self::HW_TYPE_CREATE]); + + $this->createClientWithCredentials()->request('PUT', $iri, ['json' => [ + 'name' => self::HW_TYPE_UPDATE, + ]]); + + $this->assertResponseIsSuccessful(); + $this->assertJsonContains([ + '@id' => $iri, + 'name' => self::HW_TYPE_UPDATE, + ]); + } + + /** + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + */ + public function testDeleteHardwareType(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + HardwareTypeFactory::createOne(['name' => self::HW_TYPE_DELETE]); + $iri = $this->findIriBy(HardwareType::class, ['name' => self::HW_TYPE_DELETE]); + + $this->createClientWithCredentials()->request('DELETE', $iri); + $this->assertResponseStatusCodeSame(204); + $this->assertNull( + static::getContainer()->get('doctrine')->getRepository(HardwareType::class)->findOneBy(['name' => self::HW_TYPE_DELETE]) + ); + } +} \ No newline at end of file diff --git a/tests/Functional/ImageTest.php b/tests/Functional/ImageTest.php new file mode 100644 index 0000000..b4e95fc --- /dev/null +++ b/tests/Functional/ImageTest.php @@ -0,0 +1,136 @@ + self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + ImageFactory::createMany(10); + + $this->createClientWithCredentials()->request('GET', '/images'); + $this->assertResponseStatusCodeSame(Response::HTTP_OK); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/Image', + '@id' => '/images', + '@type' => 'hydra:Collection', + 'hydra:totalItems' => 10, + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testCreateImage(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + ClientFactory::createOne(['name' => self::CLIENT]); + $clientIri = $this->findIriBy(Client::class, ['name' => self::CLIENT]); + + SoftwareProfileFactory::createOne(['description' => self::SOFTWARE_PROFILE]); + $swPIri = $this->findIriBy(SoftwareProfile::class, ['description' => self::SOFTWARE_PROFILE]); + + $this->createClientWithCredentials()->request('POST', '/images',['json' => [ + 'name' => self::IMAGE_CREATE, + 'size' => 123, + 'path' => '/path/to/image', + 'type' => 'type', + 'client' => $clientIri, + 'softwareProfile' => $swPIri + ]]); + + $this->assertResponseStatusCodeSame(201); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/ImageOutput', + '@type' => 'Image', + 'name' => self::IMAGE_CREATE, + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testUpdateImage(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + ImageFactory::createOne(['name' => self::IMAGE_CREATE]); + $iri = $this->findIriBy(Image::class, ['name' => self::IMAGE_CREATE]); + + $this->createClientWithCredentials()->request('PUT', $iri, ['json' => [ + 'name' => self::IMAGE_UPDATE, + 'size' => 123 + ]]); + + $this->assertResponseIsSuccessful(); + $this->assertJsonContains([ + '@id' => $iri, + 'name' => self::IMAGE_UPDATE, + 'size' => 123 + ]); + } + + /** + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + */ + public function testDeleteImage(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + ImageFactory::createOne(['name' => self::IMAGE_DELETE]); + $iri = $this->findIriBy(Image::class, ['name' => self::IMAGE_DELETE]); + + $this->createClientWithCredentials()->request('DELETE', $iri); + $this->assertResponseStatusCodeSame(204); + $this->assertNull( + static::getContainer()->get('doctrine')->getRepository(Client::class)->findOneBy(['name' => self::IMAGE_DELETE]) + ); + } +} \ No newline at end of file diff --git a/tests/Functional/MenuTest.php b/tests/Functional/MenuTest.php new file mode 100644 index 0000000..4276047 --- /dev/null +++ b/tests/Functional/MenuTest.php @@ -0,0 +1,129 @@ + self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + MenuFactory::createMany(10); + + $this->createClientWithCredentials()->request('GET', '/menus'); + $this->assertResponseStatusCodeSame(Response::HTTP_OK); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/Menu', + '@id' => '/menus', + '@type' => 'hydra:Collection', + 'hydra:totalItems' => 10, + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testCreateMenu(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + $this->createClientWithCredentials()->request('POST', '/menus',['json' => [ + 'name' => self::MENU_CREATE, + 'title' => self::MENU_CREATE, + 'resolution' => "1920x1080", + ]]); + + $this->assertResponseStatusCodeSame(201); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/MenuOutput', + '@type' => 'Menu', + 'name' => self::MENU_CREATE, + 'title' => self::MENU_CREATE, + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testUpdateMenu(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + MenuFactory::createOne(['name' => self::MENU_UPDATE, 'title' => self::MENU_UPDATE, 'resolution' => "1920x1080"]); + $iri = $this->findIriBy(Menu::class, ['name' => self::MENU_UPDATE]); + + $this->createClientWithCredentials()->request('PUT', $iri, ['json' => [ + 'name' => self::MENU_UPDATE, + 'resolution' => '1080x768' + ]]); + + $this->assertResponseIsSuccessful(); + $this->assertJsonContains([ + '@id' => $iri, + 'name' => self::MENU_UPDATE, + 'resolution' => '1080x768' + ]); + } + + /** + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + */ + public function testDeleteMenu(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + MenuFactory::createOne(['name' => self::MENU_DELETE, 'title' => self::MENU_DELETE, 'resolution' => "1920x1080"]); + $iri = $this->findIriBy(Menu::class, ['name' => self::MENU_DELETE]); + + $this->createClientWithCredentials()->request('DELETE', $iri); + $this->assertResponseStatusCodeSame(204); + $this->assertNull( + static::getContainer()->get('doctrine')->getRepository(Menu::class)->findOneBy(['name' => self::MENU_DELETE]) + ); + } +} \ No newline at end of file diff --git a/tests/Functional/OperativeSystemTest.php b/tests/Functional/OperativeSystemTest.php new file mode 100644 index 0000000..0a0a3f8 --- /dev/null +++ b/tests/Functional/OperativeSystemTest.php @@ -0,0 +1,117 @@ + self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + OperativeSystemFactory::createMany(10); + + $this->createClientWithCredentials()->request('GET', '/operative-systems'); + $this->assertResponseStatusCodeSame(Response::HTTP_OK); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/OperativeSystem', + '@id' => '/operative-systems', + '@type' => 'hydra:Collection', + 'hydra:totalItems' => 10, + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testCreateOperativeSystem(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + $this->createClientWithCredentials()->request('POST', '/operative-systems',['json' => [ + 'name' => self::OS_CREATE, + ]]); + + $this->assertResponseStatusCodeSame(201); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/OperativeSystemOutput', + '@type' => 'OperativeSystem', + 'name' => self::OS_CREATE + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testUpdateOperativeSystem(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + OperativeSystemFactory::createOne(['name' => self::OS_CREATE]); + $iri = $this->findIriBy(OperativeSystem::class, ['name' => self::OS_CREATE]); + + $this->createClientWithCredentials()->request('PUT', $iri, ['json' => [ + 'name' => self::OS_UPDATE, + ]]); + + $this->assertResponseIsSuccessful(); + $this->assertJsonContains([ + '@id' => $iri, + 'name' => self::OS_UPDATE, + ]); + } + + /** + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + */ + public function testDeleteOperativeSystem(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + OperativeSystemFactory::createOne(['name' => self::OS_DELETE]); + $iri = $this->findIriBy(OperativeSystem::class, ['name' => self::OS_DELETE]); + + $this->createClientWithCredentials()->request('DELETE', $iri); + $this->assertResponseStatusCodeSame(204); + $this->assertNull( + static::getContainer()->get('doctrine')->getRepository(OperativeSystem::class)->findOneBy(['name' => self::OS_DELETE]) + ); + } +} \ No newline at end of file diff --git a/tests/Functional/OrganizationalUnitTest.php b/tests/Functional/OrganizationalUnitTest.php new file mode 100644 index 0000000..899093b --- /dev/null +++ b/tests/Functional/OrganizationalUnitTest.php @@ -0,0 +1,125 @@ + self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + OrganizationalUnitFactory::createMany(2, ['type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT]); + OrganizationalUnitFactory::createMany(2, ['type' => OrganizationalUnitTypes::CLASSROOMS_GROUP]); + OrganizationalUnitFactory::createMany(2, ['type' => OrganizationalUnitTypes::CLASSROOM]); + OrganizationalUnitFactory::createMany(2, ['type' => OrganizationalUnitTypes::CLIENTS_GROUP]); + + $this->createClientWithCredentials()->request('GET', '/organizational-units'); + $this->assertResponseStatusCodeSame(Response::HTTP_OK); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/OrganizationalUnit', + '@id' => '/organizational-units', + '@type' => 'hydra:Collection', + 'hydra:totalItems' => 8, + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testCreateOrganizationalUnit(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + $this->createClientWithCredentials()->request('POST', '/organizational-units',['json' => [ + 'name' => self::ORGANIZATIONAL_UNIT_CREATE, + 'type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT, + ]]); + + $this->assertResponseStatusCodeSame(201); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/OrganizationalUnitOutput', + '@type' => 'OrganizationalUnit', + 'name' => self::ORGANIZATIONAL_UNIT_CREATE, + 'type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT, + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testUpdateOrganizationalUnit(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + OrganizationalUnitFactory::createOne(['name' => self::ORGANIZATIONAL_UNIT_CREATE, 'type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT]); + $iri = $this->findIriBy(OrganizationalUnit::class, ['name' => self::ORGANIZATIONAL_UNIT_CREATE]); + + $this->createClientWithCredentials()->request('PUT', $iri, ['json' => [ + 'name' => self::ORGANIZATIONAL_UNIT_UPDATE, + 'comments' => 'comments', + ]]); + + $this->assertResponseIsSuccessful(); + $this->assertJsonContains([ + '@id' => $iri, + 'name' => self::ORGANIZATIONAL_UNIT_UPDATE, + 'comments' => 'comments' + ]); + } + + /** + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + */ + public function testDeleteOrganizationalUnit(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + OrganizationalUnitFactory::createOne(['name' => self::ORGANIZATIONAL_UNIT_DELETE, 'type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT]); + $iri = $this->findIriBy(OrganizationalUnit::class, ['name' => self::ORGANIZATIONAL_UNIT_DELETE]); + + $this->createClientWithCredentials()->request('DELETE', $iri); + $this->assertResponseStatusCodeSame(204); + $this->assertNull( + static::getContainer()->get('doctrine')->getRepository(UserGroup::class)->findOneBy(['name' => self::ORGANIZATIONAL_UNIT_DELETE]) + ); + } +} \ No newline at end of file diff --git a/tests/Functional/PartitionTest.php b/tests/Functional/PartitionTest.php new file mode 100644 index 0000000..39debe4 --- /dev/null +++ b/tests/Functional/PartitionTest.php @@ -0,0 +1,119 @@ + self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + PartitionFactory::createMany(10); + + $this->createClientWithCredentials()->request('GET', '/partitions'); + $this->assertResponseStatusCodeSame(Response::HTTP_OK); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/Partition', + '@id' => '/partitions', + '@type' => 'hydra:Collection', + 'hydra:totalItems' => 10, + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testCreatePartition(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + $ou = OrganizationalUnitFactory::createOne(['type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT]); + $hp = HardwareProfileFactory::createOne(['description' => self::HW_PROFILE]); + + ClientFactory::createOne(['name' => self::CLIENT_CREATE, 'serialNumber' => '123abc', 'organizationalUnit' => $ou, 'hardwareProfile' => $hp]); + $iri = $this->findIriBy(Client::class, ['name' => self::CLIENT_CREATE]); + + OperativeSystemFactory::createOne(['name' => 'Ubuntu']); + $osIri = $this->findIriBy(OperativeSystem::class, ['name' => 'Ubuntu']); + + $this->createClientWithCredentials()->request('POST', '/partitions',['json' => [ + 'size' => 100, + 'operativeSystem' => $osIri, + 'client' => $iri, + 'memoryUsage' => 100 + ]]); + + $this->assertResponseStatusCodeSame(201); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/PartitionOutput', + '@type' => 'Partition', + 'size' => 100, + 'memoryUsage' => 100 + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testUpdatePartition(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + PartitionFactory::createOne(['size' => 100, 'memoryUsage' => 100]); + $iri = $this->findIriBy(Partition::class, ['size' => 100, 'memoryUsage' => 100]); + + $this->createClientWithCredentials()->request('PUT', $iri, ['json' => [ + 'size' => 200, + 'memoryUsage' => 300 + ]]); + + $this->assertResponseIsSuccessful(); + $this->assertJsonContains([ + '@id' => $iri, + 'size' => 200, + 'memoryUsage' => 300 + ]); + } +} \ No newline at end of file diff --git a/tests/Functional/SoftwareProfileTest.php b/tests/Functional/SoftwareProfileTest.php new file mode 100644 index 0000000..8d2ac62 --- /dev/null +++ b/tests/Functional/SoftwareProfileTest.php @@ -0,0 +1,124 @@ + self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + SoftwareProfileFactory::createMany(10); + + $this->createClientWithCredentials()->request('GET', '/software-profiles'); + $this->assertResponseStatusCodeSame(Response::HTTP_OK); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/SoftwareProfile', + '@id' => '/software-profiles', + '@type' => 'hydra:Collection', + 'hydra:totalItems' => 10, + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testCreateSoftwareProfile(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + OrganizationalUnitFactory::createOne(['type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT]); + $ouIri = $this->findIriBy(OrganizationalUnit::class, ['type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT]); + + $this->createClientWithCredentials()->request('POST', '/software-profiles',['json' => [ + 'description' => self::SW_PROFILE_CREATE, + 'organizationalUnit' => $ouIri + ]]); + + $this->assertResponseStatusCodeSame(201); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/SoftwareProfileOutput', + '@type' => 'SoftwareProfile', + 'description' => self::SW_PROFILE_CREATE + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testUpdateSoftwareProfile(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + SoftwareProfileFactory::createOne(['description' => self::SW_PROFILE_CREATE]); + $iri = $this->findIriBy(SoftwareProfile::class, ['description' => self::SW_PROFILE_CREATE]); + + $this->createClientWithCredentials()->request('PUT', $iri, ['json' => [ + 'description' => self::SW_PROFILE_UPDATE, + ]]); + + $this->assertResponseIsSuccessful(); + $this->assertJsonContains([ + '@id' => $iri, + 'description' => self::SW_PROFILE_UPDATE, + ]); + } + + /** + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + */ + public function testDeleteSoftwareProfile(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + SoftwareProfileFactory::createOne(['description' => self::SW_PROFILE_DELETE]); + $iri = $this->findIriBy(SoftwareProfile::class, ['description' => self::SW_PROFILE_DELETE]); + + $this->createClientWithCredentials()->request('DELETE', $iri); + $this->assertResponseStatusCodeSame(204); + $this->assertNull( + static::getContainer()->get('doctrine')->getRepository(SoftwareProfile::class)->findOneBy(['description' => self::SW_PROFILE_DELETE]) + ); + } +} \ No newline at end of file diff --git a/tests/Functional/SoftwareTest.php b/tests/Functional/SoftwareTest.php new file mode 100644 index 0000000..07f41dd --- /dev/null +++ b/tests/Functional/SoftwareTest.php @@ -0,0 +1,118 @@ + self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + SoftwareFactory::createMany(10); + + $this->createClientWithCredentials()->request('GET', '/software'); + $this->assertResponseStatusCodeSame(Response::HTTP_OK); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/Software', + '@id' => '/software', + '@type' => 'hydra:Collection', + 'hydra:totalItems' => 10, + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testCreateSoftware(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + $this->createClientWithCredentials()->request('POST', '/software',['json' => [ + 'name' => self::SW_CREATE, + ]]); + + $this->assertResponseStatusCodeSame(201); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/SoftwareOutput', + '@type' => 'Software', + 'name' => self::SW_CREATE + ]); + } + + /** + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + */ + public function testUpdateSoftware(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + SoftwareFactory::createOne(['name' => self::SW_CREATE]); + $iri = $this->findIriBy(Software::class, ['name' => self::SW_CREATE]); + + $this->createClientWithCredentials()->request('PUT', $iri, ['json' => [ + 'name' => self::SW_UPDATE, + ]]); + + $this->assertResponseIsSuccessful(); + $this->assertJsonContains([ + '@id' => $iri, + 'name' => self::SW_UPDATE, + ]); + } + + /** + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + * @throws RedirectionExceptionInterface + * @throws DecodingExceptionInterface + * @throws ClientExceptionInterface + */ + public function testDeleteSoftware(): void + { + UserFactory::createOne(['username' => self::USER_ADMIN, 'roles'=> [UserGroupPermissions::ROLE_SUPER_ADMIN]]); + + SoftwareFactory::createOne(['name' => self::SW_DELETE]); + $iri = $this->findIriBy(Software::class, ['name' => self::SW_DELETE]); + + $this->createClientWithCredentials()->request('DELETE', $iri); + $this->assertResponseStatusCodeSame(204); + $this->assertNull( + static::getContainer()->get('doctrine')->getRepository(Software::class)->findOneBy(['name' => self::SW_DELETE]) + ); + } +} \ No newline at end of file diff --git a/tests/Functional/UserGroupTest.php b/tests/Functional/UserGroupTest.php index 257360e..bc38bfe 100644 --- a/tests/Functional/UserGroupTest.php +++ b/tests/Functional/UserGroupTest.php @@ -2,7 +2,6 @@ namespace Functional; -use App\Entity\User; use App\Entity\UserGroup; use App\Factory\UserFactory; use App\Factory\UserGroupFactory; @@ -16,12 +15,11 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; class UserGroupTest extends AbstractTest { - CONST USER_ADMIN = 'ogadmin'; - - CONST USER_GROUP_CREATE = 'test-user-group-create'; - CONST USER_GROUP_UPDATE = 'test-user-group-update'; - CONST USER_GROUP_DELETE = 'test-user-group-delete'; - CONST ROLE_ORGANIZATIONAL_UNIT_ADMIN = 'ROLE_ORGANIZATIONAL_UNIT_ADMIN'; + CONST string USER_ADMIN = 'ogadmin'; + CONST string USER_GROUP_CREATE = 'test-user-group-create'; + CONST string USER_GROUP_UPDATE = 'test-user-group-update'; + CONST string USER_GROUP_DELETE = 'test-user-group-delete'; + CONST string ROLE_ORGANIZATIONAL_UNIT_ADMIN = 'ROLE_ORGANIZATIONAL_UNIT_ADMIN'; /** * @throws RedirectionExceptionInterface