diff --git a/Back_end/.env b/Back_end/.env index db996e8cd8bbcf0aa5b484ab9ae5ee4ba7f64118..79b8c7e5c23775bbdcff81b64092849a854a5d12 100644 --- a/Back_end/.env +++ b/Back_end/.env @@ -39,3 +39,7 @@ MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0 ###> symfony/mailer ### # MAILER_DSN=null://null ###< symfony/mailer ### + +###> nelmio/cors-bundle ### +CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$' +###< nelmio/cors-bundle ### diff --git a/Back_end/composer.json b/Back_end/composer.json index b8b3f90db1bd7b2bb4884c621d84160808a878a9..63f8131ae0eda5c7f857ce266c83283797c23115 100644 --- a/Back_end/composer.json +++ b/Back_end/composer.json @@ -7,10 +7,11 @@ "php": ">=8.2", "ext-ctype": "*", "ext-iconv": "*", + "api-platform/core": "^3.2", "doctrine/doctrine-bundle": "^2.11", "doctrine/doctrine-migrations-bundle": "^3.3", "doctrine/orm": "^2.17", - "nelmio/api-doc-bundle": "^4.18", + "nelmio/cors-bundle": "^2.4", "phpdocumentor/reflection-docblock": "^5.3", "phpstan/phpdoc-parser": "^1.25", "symfony/asset": "7.0.*", diff --git a/Back_end/composer.lock b/Back_end/composer.lock index 173163bcc4929d31e7979a67857c30e176e9faa0..04acc546eb0da9b2061e73edf453a9a59b24b150 100644 --- a/Back_end/composer.lock +++ b/Back_end/composer.lock @@ -4,8 +4,173 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1184319739054503af35310e8d42d23b", + "content-hash": "83deeb04b637c791f60f3e5418d7efae", "packages": [ + { + "name": "api-platform/core", + "version": "v3.2.11", + "source": { + "type": "git", + "url": "https://github.com/api-platform/core.git", + "reference": "227c85871b00613f427ea985b54f4af24ce56a29" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/api-platform/core/zipball/227c85871b00613f427ea985b54f4af24ce56a29", + "reference": "227c85871b00613f427ea985b54f4af24ce56a29", + "shasum": "" + }, + "require": { + "doctrine/inflector": "^1.0 || ^2.0", + "php": ">=8.1", + "psr/cache": "^1.0 || ^2.0 || ^3.0", + "psr/container": "^1.0 || ^2.0", + "symfony/deprecation-contracts": "^3.1", + "symfony/http-foundation": "^6.1 || ^7.0", + "symfony/http-kernel": "^6.1 || ^7.0", + "symfony/property-access": "^6.1 || ^7.0", + "symfony/property-info": "^6.1 || ^7.0", + "symfony/serializer": "^6.1 || ^7.0", + "symfony/translation-contracts": "^3.3", + "symfony/web-link": "^6.1 || ^7.0", + "willdurand/negotiation": "^3.0" + }, + "conflict": { + "doctrine/common": "<3.2.2", + "doctrine/dbal": "<2.10", + "doctrine/mongodb-odm": "<2.4", + "doctrine/orm": "<2.14.0", + "doctrine/persistence": "<1.3", + "elasticsearch/elasticsearch": ">=8.0,<8.4", + "phpspec/prophecy": "<1.15", + "phpunit/phpunit": "<9.5", + "symfony/var-exporter": "<6.1.1" + }, + "require-dev": { + "behat/behat": "^3.11", + "behat/mink": "^1.9", + "doctrine/cache": "^1.11 || ^2.1", + "doctrine/common": "^3.2.2", + "doctrine/dbal": "^3.4.0", + "doctrine/doctrine-bundle": "^1.12 || ^2.0", + "doctrine/mongodb-odm": "^2.2", + "doctrine/orm": "^2.14", + "elasticsearch/elasticsearch": "^7.11 || ^8.4", + "friends-of-behat/mink-browserkit-driver": "^1.3.1", + "friends-of-behat/mink-extension": "^2.2", + "friends-of-behat/symfony-extension": "^2.1", + "guzzlehttp/guzzle": "^6.0 || ^7.0", + "jangregor/phpstan-prophecy": "^1.0", + "justinrainbow/json-schema": "^5.2.1", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpdoc-parser": "^1.13", + "phpstan/phpstan": "^1.1", + "phpstan/phpstan-doctrine": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-symfony": "^1.0", + "phpunit/phpunit": "^9.5", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "ramsey/uuid": "^3.9.7 || ^4.0", + "ramsey/uuid-doctrine": "^1.4 || ^2.0", + "sebastian/comparator": "<5.0", + "soyuka/contexts": "v3.3.9", + "soyuka/stubs-mongodb": "^1.0", + "symfony/asset": "^6.1 || ^7.0", + "symfony/browser-kit": "^6.1 || ^7.0", + "symfony/cache": "^6.1 || ^7.0", + "symfony/config": "^6.1 || ^7.0", + "symfony/console": "^6.1 || ^7.0", + "symfony/css-selector": "^6.1 || ^7.0", + "symfony/dependency-injection": "^6.1 || ^7.0.12", + "symfony/doctrine-bridge": "^6.1 || ^7.0", + "symfony/dom-crawler": "^6.1 || ^7.0", + "symfony/error-handler": "^6.1 || ^7.0", + "symfony/event-dispatcher": "^6.1 || ^7.0", + "symfony/expression-language": "^6.1 || ^7.0", + "symfony/finder": "^6.1 || ^7.0", + "symfony/form": "^6.1 || ^7.0", + "symfony/framework-bundle": "^6.1 || ^7.0", + "symfony/http-client": "^6.1 || ^7.0", + "symfony/intl": "^6.1 || ^7.0", + "symfony/maker-bundle": "^1.24", + "symfony/mercure-bundle": "*", + "symfony/messenger": "^6.1 || ^7.0", + "symfony/phpunit-bridge": "^6.1 || ^7.0", + "symfony/routing": "^6.1 || ^7.0", + "symfony/security-bundle": "^6.1 || ^7.0", + "symfony/security-core": "^6.1 || ^7.0", + "symfony/stopwatch": "^6.1 || ^7.0", + "symfony/twig-bundle": "^6.1 || ^7.0", + "symfony/uid": "^6.1 || ^7.0", + "symfony/validator": "^6.1 || ^7.0", + "symfony/web-profiler-bundle": "^6.1 || ^7.0", + "symfony/yaml": "^6.1 || ^7.0", + "twig/twig": "^1.42.3 || ^2.12 || ^3.0", + "webonyx/graphql-php": "^14.0 || ^15.0" + }, + "suggest": { + "doctrine/mongodb-odm-bundle": "To support MongoDB. Only versions 4.0 and later are supported.", + "elasticsearch/elasticsearch": "To support Elasticsearch.", + "ocramius/package-versions": "To display the API Platform's version in the debug bar.", + "phpstan/phpdoc-parser": "To support extracting metadata from PHPDoc.", + "psr/cache-implementation": "To use metadata caching.", + "ramsey/uuid": "To support Ramsey's UUID identifiers.", + "symfony/cache": "To have metadata caching when using Symfony integration.", + "symfony/config": "To load XML configuration files.", + "symfony/expression-language": "To use authorization features.", + "symfony/http-client": "To use the HTTP cache invalidation system.", + "symfony/messenger": "To support messenger integration.", + "symfony/security": "To use authorization features.", + "symfony/twig-bundle": "To use the Swagger UI integration.", + "symfony/uid": "To support Symfony UUID/ULID identifiers.", + "symfony/web-profiler-bundle": "To use the data collector.", + "webonyx/graphql-php": "To support GraphQL." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.3.x-dev" + }, + "symfony": { + "require": "^6.1 || ^7.0" + } + }, + "autoload": { + "psr-4": { + "ApiPlatform\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kévin Dunglas", + "email": "kevin@dunglas.fr", + "homepage": "https://dunglas.fr" + } + ], + "description": "Build a fully-featured hypermedia or GraphQL API in minutes!", + "homepage": "https://api-platform.com", + "keywords": [ + "Hydra", + "JSON-LD", + "api", + "graphql", + "hal", + "jsonapi", + "openapi", + "rest", + "swagger" + ], + "support": { + "issues": "https://github.com/api-platform/core/issues", + "source": "https://github.com/api-platform/core/tree/v3.2.11" + }, + "time": "2024-01-12T13:17:28+00:00" + }, { "name": "composer/semver", "version": "3.4.0", @@ -820,16 +985,16 @@ }, { "name": "doctrine/inflector", - "version": "2.0.8", + "version": "2.0.9", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "f9301a5b2fb1216b2b08f02ba04dc45423db6bff" + "reference": "2930cd5ef353871c821d5c43ed030d39ac8cfe65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/f9301a5b2fb1216b2b08f02ba04dc45423db6bff", - "reference": "f9301a5b2fb1216b2b08f02ba04dc45423db6bff", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/2930cd5ef353871c821d5c43ed030d39ac8cfe65", + "reference": "2930cd5ef353871c821d5c43ed030d39ac8cfe65", "shasum": "" }, "require": { @@ -891,7 +1056,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.8" + "source": "https://github.com/doctrine/inflector/tree/2.0.9" }, "funding": [ { @@ -907,7 +1072,7 @@ "type": "tidelift" } ], - "time": "2023-06-16T13:40:37+00:00" + "time": "2024-01-15T18:05:13+00:00" }, { "name": "doctrine/instantiator", @@ -1579,88 +1744,39 @@ "time": "2023-10-27T15:32:31+00:00" }, { - "name": "nelmio/api-doc-bundle", - "version": "v4.18.1", + "name": "nelmio/cors-bundle", + "version": "2.4.0", "source": { "type": "git", - "url": "https://github.com/nelmio/NelmioApiDocBundle.git", - "reference": "2360674a7bd8bbf5fb834b08e89662b6ad851618" + "url": "https://github.com/nelmio/NelmioCorsBundle.git", + "reference": "78fcdb91f76b080a1008133def9c7f613833933d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nelmio/NelmioApiDocBundle/zipball/2360674a7bd8bbf5fb834b08e89662b6ad851618", - "reference": "2360674a7bd8bbf5fb834b08e89662b6ad851618", + "url": "https://api.github.com/repos/nelmio/NelmioCorsBundle/zipball/78fcdb91f76b080a1008133def9c7f613833933d", + "reference": "78fcdb91f76b080a1008133def9c7f613833933d", "shasum": "" }, "require": { - "ext-json": "*", - "php": ">=7.2", - "phpdocumentor/reflection-docblock": "^3.1|^4.0|^5.0", - "psr/cache": "^1.0|^2.0|^3.0", - "psr/container": "^1.0|^2.0", - "psr/log": "^1.0|^2.0|^3.0", - "symfony/config": "^5.4|^6.0|^7.0", - "symfony/console": "^5.4|^6.0|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/framework-bundle": "^5.4.24|^6.0|^7.0", - "symfony/http-foundation": "^5.4|^6.0|^7.0", - "symfony/http-kernel": "^5.4|^6.0|^7.0", - "symfony/options-resolver": "^5.4|^6.0|^7.0", - "symfony/property-info": "^5.4|^6.0|^7.0", - "symfony/routing": "^5.4|^6.0|^7.0", - "zircote/swagger-php": "^4.2.15" + "psr/log": "^1.0 || ^2.0 || ^3.0", + "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "api-platform/core": "^2.7.0|^3", - "composer/package-versions-deprecated": "1.11.99.1", - "doctrine/annotations": "^2.0", - "friendsofsymfony/rest-bundle": "^2.8|^3.0", - "jms/serializer": "^1.14|^3.0", - "jms/serializer-bundle": "^2.3|^3.0|^4.0|^5.0", - "phpunit/phpunit": "^8.5|^9.6", - "sensio/framework-extra-bundle": "^5.4|^6.0", - "symfony/asset": "^5.4|^6.0|^7.0", - "symfony/browser-kit": "^5.4|^6.0|^7.0", - "symfony/cache": "^5.4|^6.0|^7.0", - "symfony/dom-crawler": "^5.4|^6.0|^7.0", - "symfony/expression-language": "^5.4|^6.0|^7.0", - "symfony/form": "^5.4|^6.0|^7.0", - "symfony/phpunit-bridge": "^6.4", - "symfony/property-access": "^5.4|^6.0|^7.0", - "symfony/serializer": "^5.4|^6.0|^7.0", - "symfony/stopwatch": "^5.4|^6.0|^7.0", - "symfony/templating": "^5.4|^6.0|^7.0", - "symfony/twig-bundle": "^5.4|^6.0|^7.0", - "symfony/validator": "^5.4|^6.0|^7.0", - "willdurand/hateoas-bundle": "^1.0|^2.0" - }, - "suggest": { - "api-platform/core": "For using an API oriented framework.", - "doctrine/annotations": "For using doctrine annotations", - "friendsofsymfony/rest-bundle": "For using the parameters annotations.", - "jms/serializer-bundle": "For describing your models.", - "symfony/asset": "For using the Swagger UI.", - "symfony/cache": "For using a PSR-6 compatible cache implementation with the API doc generator.", - "symfony/form": "For describing your form type models.", - "symfony/monolog-bundle": "For using a PSR-3 compatible logger implementation with the API PHP describer.", - "symfony/serializer": "For describing your models.", - "symfony/twig-bundle": "For using the Swagger UI.", - "symfony/validator": "For describing the validation constraints in your models.", - "willdurand/hateoas-bundle": "For extracting HATEOAS metadata." + "mockery/mockery": "^1.3.6", + "symfony/phpunit-bridge": "^5.4 || ^6.0 || ^7.0" }, "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { "psr-4": { - "Nelmio\\ApiDocBundle\\": "" + "Nelmio\\CorsBundle\\": "" }, "exclude-from-classmap": [ - "Tests/" + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1674,21 +1790,20 @@ }, { "name": "Symfony Community", - "homepage": "https://github.com/nelmio/NelmioApiDocBundle/contributors" + "homepage": "https://github.com/nelmio/NelmioCorsBundle/contributors" } ], - "description": "Generates documentation for your REST API from annotations", + "description": "Adds CORS (Cross-Origin Resource Sharing) headers support in your Symfony application", "keywords": [ "api", - "doc", - "documentation", - "rest" + "cors", + "crossdomain" ], "support": { - "issues": "https://github.com/nelmio/NelmioApiDocBundle/issues", - "source": "https://github.com/nelmio/NelmioApiDocBundle/tree/v4.18.1" + "issues": "https://github.com/nelmio/NelmioCorsBundle/issues", + "source": "https://github.com/nelmio/NelmioCorsBundle/tree/2.4.0" }, - "time": "2024-01-15T16:16:29+00:00" + "time": "2023-11-30T16:41:19+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -1802,16 +1917,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.7.3", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419" + "reference": "fad452781b3d774e3337b0c0b245dd8e5a4455fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419", - "reference": "3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fad452781b3d774e3337b0c0b245dd8e5a4455fc", + "reference": "fad452781b3d774e3337b0c0b245dd8e5a4455fc", "shasum": "" }, "require": { @@ -1854,9 +1969,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.3" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.0" }, - "time": "2023-08-12T11:01:26+00:00" + "time": "2024-01-11T11:49:22+00:00" }, { "name": "phpstan/phpdoc-parser", @@ -7660,85 +7775,60 @@ "time": "2022-06-03T18:03:27+00:00" }, { - "name": "zircote/swagger-php", - "version": "4.8.3", + "name": "willdurand/negotiation", + "version": "3.1.0", "source": { "type": "git", - "url": "https://github.com/zircote/swagger-php.git", - "reference": "598958d8a83cfbd44ba36388b2f9ed69e8b86ed4" + "url": "https://github.com/willdurand/Negotiation.git", + "reference": "68e9ea0553ef6e2ee8db5c1d98829f111e623ec2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zircote/swagger-php/zipball/598958d8a83cfbd44ba36388b2f9ed69e8b86ed4", - "reference": "598958d8a83cfbd44ba36388b2f9ed69e8b86ed4", + "url": "https://api.github.com/repos/willdurand/Negotiation/zipball/68e9ea0553ef6e2ee8db5c1d98829f111e623ec2", + "reference": "68e9ea0553ef6e2ee8db5c1d98829f111e623ec2", "shasum": "" }, "require": { - "ext-json": "*", - "php": ">=7.2", - "psr/log": "^1.1 || ^2.0 || ^3.0", - "symfony/deprecation-contracts": "^2 || ^3", - "symfony/finder": ">=2.2", - "symfony/yaml": ">=3.3" + "php": ">=7.1.0" }, "require-dev": { - "composer/package-versions-deprecated": "^1.11", - "doctrine/annotations": "^1.7 || ^2.0", - "friendsofphp/php-cs-fixer": "^2.17 || ^3.0", - "phpstan/phpstan": "^1.6", - "phpunit/phpunit": ">=8", - "vimeo/psalm": "^4.23" - }, - "suggest": { - "doctrine/annotations": "^1.7 || ^2.0" + "symfony/phpunit-bridge": "^5.0" }, - "bin": [ - "bin/openapi" - ], "type": "library", "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { "psr-4": { - "OpenApi\\": "src" + "Negotiation\\": "src/Negotiation" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Apache-2.0" + "MIT" ], "authors": [ { - "name": "Robert Allen", - "email": "zircote@gmail.com" - }, - { - "name": "Bob Fanger", - "email": "bfanger@gmail.com", - "homepage": "https://bfanger.nl" - }, - { - "name": "Martin Rademacher", - "email": "mano@radebatz.net", - "homepage": "https://radebatz.net" + "name": "William Durand", + "email": "will+git@drnd.me" } ], - "description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations", - "homepage": "https://github.com/zircote/swagger-php/", + "description": "Content Negotiation tools for PHP provided as a standalone library.", + "homepage": "http://williamdurand.fr/Negotiation/", "keywords": [ - "api", - "json", - "rest", - "service discovery" + "accept", + "content", + "format", + "header", + "negotiation" ], "support": { - "issues": "https://github.com/zircote/swagger-php/issues", - "source": "https://github.com/zircote/swagger-php/tree/4.8.3" + "issues": "https://github.com/willdurand/Negotiation/issues", + "source": "https://github.com/willdurand/Negotiation/tree/3.1.0" }, - "time": "2024-01-07T22:33:09+00:00" + "time": "2022-01-30T20:08:53+00:00" } ], "packages-dev": [ diff --git a/Back_end/config/bundles.php b/Back_end/config/bundles.php index 4e3a56077fb806de5799fe7e82171145e3ce4ff5..14a75231b81f40909f792e187a3597abe1261bf2 100644 --- a/Back_end/config/bundles.php +++ b/Back_end/config/bundles.php @@ -13,4 +13,6 @@ return [ Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], + Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], + ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], ]; diff --git a/Back_end/config/packages/api_platform.yaml b/Back_end/config/packages/api_platform.yaml new file mode 100644 index 0000000000000000000000000000000000000000..098b643d47782faad78620d66456724dd9035acb --- /dev/null +++ b/Back_end/config/packages/api_platform.yaml @@ -0,0 +1,18 @@ +api_platform: + title: API SAE S5 + version: 1.0.0 + formats: + jsonld: ['application/ld+json'] + docs_formats: + jsonld: ['application/ld+json'] + jsonopenapi: ['application/vnd.openapi+json'] + html: ['text/html'] + defaults: + stateless: true + cache_headers: + vary: ['Content-Type', 'Authorization', 'Origin'] + extra_properties: + standard_put: true + rfc_7807_compliant_errors: true + event_listeners_backward_compatibility_layer: false + keep_legacy_inflector: false diff --git a/Back_end/config/packages/nelmio_cors.yaml b/Back_end/config/packages/nelmio_cors.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c7665081f1ea9fafe9b05ca5b34f6b9fd75617b3 --- /dev/null +++ b/Back_end/config/packages/nelmio_cors.yaml @@ -0,0 +1,10 @@ +nelmio_cors: + defaults: + origin_regex: true + allow_origin: ['%env(CORS_ALLOW_ORIGIN)%'] + allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE'] + allow_headers: ['Content-Type', 'Authorization'] + expose_headers: ['Link'] + max_age: 3600 + paths: + '^/': null diff --git a/Back_end/config/routes/api_platform.yaml b/Back_end/config/routes/api_platform.yaml new file mode 100644 index 0000000000000000000000000000000000000000..38f11cba851fd17ed81398d13694267eacb21a59 --- /dev/null +++ b/Back_end/config/routes/api_platform.yaml @@ -0,0 +1,4 @@ +api_platform: + resource: . + type: api_platform + prefix: /api diff --git a/Back_end/src/ApiResource/.gitignore b/Back_end/src/ApiResource/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Back_end/src/Entity/Unite.php b/Back_end/src/Entity/Unite.php index 4f00cb3e8e490befbb5dc91b486164402a7b1b25..397bfa27432b63ce1d9a11d40dceb29bff9fc007 100644 --- a/Back_end/src/Entity/Unite.php +++ b/Back_end/src/Entity/Unite.php @@ -2,12 +2,14 @@ namespace App\Entity; +use ApiPlatform\Metadata\ApiResource; use App\Repository\UniteRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity(repositoryClass: UniteRepository::class)] +#[ApiResource] class Unite { #[ORM\Id] @@ -72,26 +74,4 @@ class Unite { return $this->paniers; } - - public function addPanier(Panier $panier): static - { - if (!$this->paniers->contains($panier)) { - $this->paniers->add($panier); - $panier->setUniteId($this); - } - - return $this; - } - - public function removePanier(Panier $panier): static - { - if ($this->paniers->removeElement($panier)) { - // set the owning side to null (unless already changed) - if ($panier->getUniteId() === $this) { - $panier->setUniteId(null); - } - } - - return $this; - } } diff --git a/Back_end/symfony.lock b/Back_end/symfony.lock index 0afd24b2d9361f20d84821df5174aa4ee7c5867f..9bbf0cefd6d840307ef1ea96dc51cc715c366bd3 100644 --- a/Back_end/symfony.lock +++ b/Back_end/symfony.lock @@ -1,4 +1,18 @@ { + "api-platform/core": { + "version": "3.2", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "3.2", + "ref": "696d44adc3c0d4f5d25a2f1c4f3700dd8a5c6db9" + }, + "files": [ + "config/packages/api_platform.yaml", + "config/routes/api_platform.yaml", + "src/ApiResource/.gitignore" + ] + }, "doctrine/doctrine-bundle": { "version": "2.11", "recipe": { @@ -26,14 +40,17 @@ "./migrations/.gitignore" ] }, - "nelmio/api-doc-bundle": { - "version": "4.18", + "nelmio/cors-bundle": { + "version": "2.4", "recipe": { - "repo": "github.com/symfony/recipes-contrib", + "repo": "github.com/symfony/recipes", "branch": "main", - "version": "3.0", - "ref": "c8e0c38e1a280ab9e37587a8fa32b251d5bc1c94" - } + "version": "1.5", + "ref": "6bea22e6c564fba3a1391615cada1437d0bde39c" + }, + "files": [ + "config/packages/nelmio_cors.yaml" + ] }, "phpunit/phpunit": { "version": "9.6", diff --git a/README.md b/README.md index 641d77fdabc098cd310a88b65032f1d42bebb54f..dfb4859eb35f026e5b61fdc6f7bf641a71162104 100644 --- a/README.md +++ b/README.md @@ -11,4 +11,6 @@ Dans notre cas, nous avons choisi Symfony. Donc, nous avons besoin de 3 containe - Un container pour la base de données (MySQL) - Un container pour l'application (Symfony/PHP) -Un container adminer a été ajouté pour pouvoir gérer la base de données. \ No newline at end of file +Un container adminer a été ajouté pour pouvoir gérer la base de données. + +Lien vers la documentation swagger de l'api : http://localhost:8080/api \ No newline at end of file