diff --git a/api-platform/README.md b/api-platform/README.md index 76a11567f28b360e0fc0597ffdefb227a6c9cf86..9b9adbd8c85a52d58d89f2ce572295e4c7a2cd91 100644 --- a/api-platform/README.md +++ b/api-platform/README.md @@ -1,47 +1,12 @@ -

API Platform

+# Api Taxes -API Platform is a next-generation web framework designed to easily create API-first projects without compromising extensibility -and flexibility: +Emplacement du `php.ini` dans le docker : +`/usr/local/etc/php` -* Design your own data model as plain old PHP classes or [**import an existing ontology**](https://api-platform.com/docs/schema-generator). -* **Expose in minutes a hypermedia REST or a GraphQL API** with pagination, data validation, access control, relation embedding, - filters, and error handling... -* Benefit from Content Negotiation: [GraphQL](https://api-platform.com/docs/core/graphql/), [JSON-LD](https://json-ld.org), [Hydra](https://hydra-cg.com), - [HAL](https://github.com/mikekelly/hal_specification/blob/master/hal_specification.md), [JSON:API](https://jsonapi.org/), [YAML](https://yaml.org/), [JSON](https://www.json.org/), [XML](https://www.w3.org/XML/) and [CSV](https://www.ietf.org/rfc/rfc4180.txt) are supported out of the box. -* Enjoy the **beautiful automatically generated API documentation** ([OpenAPI](https://api-platform.com/docs/core/openapi/)). -* Add [**a convenient Material Design administration interface**](https://api-platform.com/docs/admin) built with [React](https://reactjs.org/) - without writing a line of code. -* **Scaffold fully functional Progressive-Web-Apps and mobile apps** built with [Next.js](https://api-platform.com/docs/client-generator/nextjs/) (React), -[Nuxt.js](https://api-platform.com/docs/client-generator/nuxtjs/) (Vue.js) or [React Native](https://api-platform.com/docs/client-generator/react-native/) -thanks to [the client generator](https://api-platform.com/docs/client-generator/) (a Vue.js generator is also available). -* Install a development environment and deploy your project in production using **[Docker](https://api-platform.com/docs/distribution)** -and [Kubernetes](https://api-platform.com/docs/deployment/kubernetes). -* Easily add **[OAuth](https://oauth.net/) authentication**. -* Create specs and tests with **[a developer friendly API testing tool](https://api-platform.com/docs/distribution/testing/)**. +Télécharger l'extension gd (pour PhpSpreadsheet) : +`install-php-extensions gd` -The official project documentation is available **[on the API Platform website](https://api-platform.com)**. - -API Platform embraces open web standards and the -[Linked Data](https://www.w3.org/standards/semanticweb/data) movement. Your API will automatically expose structured data. -It means that your API Platform application is usable **out of the box** with technologies of -the semantic web. - -It also means that **your SEO will be improved** because **[Google leverages these formats](https://developers.google.com/search/docs/guides/intro-structured-data)**. - -Last but not least, the server component of API Platform is built on top of the [Symfony](https://symfony.com) framework, -while client components leverage [React](https://reactjs.org/) ([Vue.js](https://vuejs.org/) flavors are also available). -It means that you can: - -* Use **thousands of Symfony bundles and React components** with API Platform. -* Integrate API Platform in **any existing Symfony, React, or Vue application**. -* Reuse **all your Symfony and JavaScript skills**, and benefit from the incredible amount of documentation available. -* Enjoy the popular [Doctrine ORM](https://www.doctrine-project.org/projects/orm.html) (used by default, but fully optional: - you can use the data provider you want, including but not limited to MongoDB and Elasticsearch) - -## Install - -[Read the official "Getting Started" guide](https://api-platform.com/docs/distribution/). - -## Credits - -Created by [Kévin Dunglas](https://dunglas.fr). Commercial support is available at [Les-Tilleuls.coop](https://les-tilleuls.coop). +à la ligne 38 de `api/Dockerfile` : ajouter la ligne : +``` + gd \ +``` diff --git a/api-platform/api/.gitignore b/api-platform/api/.gitignore index d270e414b426a6647813c0dca252c65e1f5ff268..f69186c48ce23a5c74c2fc470e42ec2662590bf8 100644 --- a/api-platform/api/.gitignore +++ b/api-platform/api/.gitignore @@ -7,6 +7,7 @@ /config/secrets/prod/prod.decrypt.private.php /public/bundles/ /var/ +/data/ /vendor/ ###< symfony/framework-bundle ### diff --git a/api-platform/api/Dockerfile b/api-platform/api/Dockerfile index 724c7ae8d42db29c676e7f1f92a47df5b4f5525e..70addf4bc2ce6cab637df86270a3801522adba0c 100644 --- a/api-platform/api/Dockerfile +++ b/api-platform/api/Dockerfile @@ -36,6 +36,7 @@ RUN set -eux; \ intl \ opcache \ zip \ + gd \ ; ###> recipes ### diff --git a/api-platform/api/composer.json b/api-platform/api/composer.json index e0a57331a2d7d104e71dbdc62329de5c1d6e2e07..f68eb6cc80288ec4f6b9e9a4d694c58bf5498bd1 100644 --- a/api-platform/api/composer.json +++ b/api-platform/api/composer.json @@ -32,6 +32,8 @@ }, "require-dev": { "api-platform/schema-generator": "^5.0", + "doctrine/doctrine-fixtures-bundle": "^4.3", + "phpoffice/phpspreadsheet": "^5.4", "symfony/browser-kit": "7.2.*", "symfony/css-selector": "7.2.*", "symfony/debug-bundle": "7.2.*", diff --git a/api-platform/api/composer.lock b/api-platform/api/composer.lock index 65a2a22b4e9df358433e1157203ec2ea0a2f312d..e5b2bdbbd0175bb49c39366f56aabbdae0077c0c 100644 --- a/api-platform/api/composer.lock +++ b/api-platform/api/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f98b29042d79ad1da8056f585019240e", + "content-hash": "4aa52f0fd0cd346f50dc5d5b9c9e483f", "packages": [ { "name": "api-platform/doctrine-common", @@ -7773,6 +7773,175 @@ }, "time": "2025-01-16T11:12:34+00:00" }, + { + "name": "doctrine/data-fixtures", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/data-fixtures.git", + "reference": "7a615ba135e45d67674bb623d90f34f6c7b6bd97" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/7a615ba135e45d67674bb623d90f34f6c7b6bd97", + "reference": "7a615ba135e45d67674bb623d90f34f6c7b6bd97", + "shasum": "" + }, + "require": { + "doctrine/persistence": "^3.1 || ^4.0", + "php": "^8.1", + "psr/log": "^1.1 || ^2 || ^3" + }, + "conflict": { + "doctrine/dbal": "<3.5 || >=5", + "doctrine/orm": "<2.14 || >=4", + "doctrine/phpcr-odm": "<1.3.0" + }, + "require-dev": { + "doctrine/coding-standard": "^14", + "doctrine/dbal": "^3.5 || ^4", + "doctrine/mongodb-odm": "^1.3.0 || ^2.0.0", + "doctrine/orm": "^2.14 || ^3", + "ext-sqlite3": "*", + "fig/log-test": "^1", + "phpstan/phpstan": "2.1.31", + "phpunit/phpunit": "10.5.45 || 12.4.0", + "symfony/cache": "^6.4 || ^7", + "symfony/var-exporter": "^6.4 || ^7" + }, + "suggest": { + "alcaeus/mongo-php-adapter": "For using MongoDB ODM 1.3 with PHP 7 (deprecated)", + "doctrine/mongodb-odm": "For loading MongoDB ODM fixtures", + "doctrine/orm": "For loading ORM fixtures", + "doctrine/phpcr-odm": "For loading PHPCR ODM fixtures" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\DataFixtures\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Data Fixtures for all Doctrine Object Managers", + "homepage": "https://www.doctrine-project.org", + "keywords": [ + "database" + ], + "support": { + "issues": "https://github.com/doctrine/data-fixtures/issues", + "source": "https://github.com/doctrine/data-fixtures/tree/2.2.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdata-fixtures", + "type": "tidelift" + } + ], + "time": "2025-10-17T20:06:20+00:00" + }, + { + "name": "doctrine/doctrine-fixtures-bundle", + "version": "4.3.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/DoctrineFixturesBundle.git", + "reference": "9e013ed10d49bf7746b07204d336384a7d9b5a4d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/9e013ed10d49bf7746b07204d336384a7d9b5a4d", + "reference": "9e013ed10d49bf7746b07204d336384a7d9b5a4d", + "shasum": "" + }, + "require": { + "doctrine/data-fixtures": "^2.2", + "doctrine/doctrine-bundle": "^2.2 || ^3.0", + "doctrine/orm": "^2.14.0 || ^3.0", + "doctrine/persistence": "^2.4 || ^3.0 || ^4.0", + "php": "^8.1", + "psr/log": "^2 || ^3", + "symfony/config": "^6.4 || ^7.0 || ^8.0", + "symfony/console": "^6.4 || ^7.0 || ^8.0", + "symfony/dependency-injection": "^6.4 || ^7.0 || ^8.0", + "symfony/deprecation-contracts": "^2.1 || ^3", + "symfony/doctrine-bridge": "^6.4.16 || ^7.1.9 || ^8.0", + "symfony/http-kernel": "^6.4 || ^7.0 || ^8.0" + }, + "conflict": { + "doctrine/dbal": "< 3" + }, + "require-dev": { + "doctrine/coding-standard": "14.0.0", + "phpstan/phpstan": "2.1.11", + "phpunit/phpunit": "^10.5.38 || 11.4.14" + }, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Doctrine\\Bundle\\FixturesBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Doctrine Project", + "homepage": "https://www.doctrine-project.org" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DoctrineFixturesBundle", + "homepage": "https://www.doctrine-project.org", + "keywords": [ + "Fixture", + "persistence" + ], + "support": { + "issues": "https://github.com/doctrine/DoctrineFixturesBundle/issues", + "source": "https://github.com/doctrine/DoctrineFixturesBundle/tree/4.3.1" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdoctrine-fixtures-bundle", + "type": "tidelift" + } + ], + "time": "2025-12-03T16:05:42+00:00" + }, { "name": "evenement/evenement", "version": "v3.0.2", @@ -8263,6 +8432,84 @@ ], "time": "2023-07-12T21:21:09+00:00" }, + { + "name": "maennchen/zipstream-php", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/maennchen/ZipStream-PHP.git", + "reference": "682f1098a8fddbaf43edac2306a691c7ad508ec5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/682f1098a8fddbaf43edac2306a691c7ad508ec5", + "reference": "682f1098a8fddbaf43edac2306a691c7ad508ec5", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "ext-zlib": "*", + "php-64bit": "^8.3" + }, + "require-dev": { + "brianium/paratest": "^7.7", + "ext-zip": "*", + "friendsofphp/php-cs-fixer": "^3.86", + "guzzlehttp/guzzle": "^7.5", + "mikey179/vfsstream": "^1.6", + "php-coveralls/php-coveralls": "^2.5", + "phpunit/phpunit": "^12.0", + "vimeo/psalm": "^6.0" + }, + "suggest": { + "guzzlehttp/psr7": "^2.4", + "psr/http-message": "^2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "ZipStream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paul Duncan", + "email": "pabs@pablotron.org" + }, + { + "name": "Jonatan Männchen", + "email": "jonatan@maennchen.ch" + }, + { + "name": "Jesse Donat", + "email": "donatj@gmail.com" + }, + { + "name": "András Kolesár", + "email": "kolesar@kolesar.hu" + } + ], + "description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.", + "keywords": [ + "stream", + "zip" + ], + "support": { + "issues": "https://github.com/maennchen/ZipStream-PHP/issues", + "source": "https://github.com/maennchen/ZipStream-PHP/tree/3.2.1" + }, + "funding": [ + { + "url": "https://github.com/maennchen", + "type": "github" + } + ], + "time": "2025-12-10T09:58:31+00:00" + }, { "name": "marc-mabe/php-enum", "version": "v4.7.1", @@ -8336,6 +8583,113 @@ }, "time": "2024-11-28T04:54:44+00:00" }, + { + "name": "markbaker/complex", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPComplex.git", + "reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/95c56caa1cf5c766ad6d65b6344b807c1e8405b9", + "reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-master", + "phpcompatibility/php-compatibility": "^9.3", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Complex\\": "classes/src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@lange.demon.co.uk" + } + ], + "description": "PHP Class for working with complex numbers", + "homepage": "https://github.com/MarkBaker/PHPComplex", + "keywords": [ + "complex", + "mathematics" + ], + "support": { + "issues": "https://github.com/MarkBaker/PHPComplex/issues", + "source": "https://github.com/MarkBaker/PHPComplex/tree/3.0.2" + }, + "time": "2022-12-06T16:21:08+00:00" + }, + { + "name": "markbaker/matrix", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPMatrix.git", + "reference": "728434227fe21be27ff6d86621a1b13107a2562c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/728434227fe21be27ff6d86621a1b13107a2562c", + "reference": "728434227fe21be27ff6d86621a1b13107a2562c", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-master", + "phpcompatibility/php-compatibility": "^9.3", + "phpdocumentor/phpdocumentor": "2.*", + "phploc/phploc": "^4.0", + "phpmd/phpmd": "2.*", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "sebastian/phpcpd": "^4.0", + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Matrix\\": "classes/src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@demon-angel.eu" + } + ], + "description": "PHP Class for working with matrices", + "homepage": "https://github.com/MarkBaker/PHPMatrix", + "keywords": [ + "mathematics", + "matrix", + "vector" + ], + "support": { + "issues": "https://github.com/MarkBaker/PHPMatrix/issues", + "source": "https://github.com/MarkBaker/PHPMatrix/tree/3.0.1" + }, + "time": "2022-12-02T22:17:43+00:00" + }, { "name": "masterminds/html5", "version": "2.9.0", @@ -8616,6 +8970,115 @@ }, "time": "2024-12-30T11:07:19+00:00" }, + { + "name": "phpoffice/phpspreadsheet", + "version": "5.4.0", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", + "reference": "48f2fe37d64c2dece0ef71fb2ac55497566782af" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/48f2fe37d64c2dece0ef71fb2ac55497566782af", + "reference": "48f2fe37d64c2dece0ef71fb2ac55497566782af", + "shasum": "" + }, + "require": { + "composer/pcre": "^1||^2||^3", + "ext-ctype": "*", + "ext-dom": "*", + "ext-fileinfo": "*", + "ext-filter": "*", + "ext-gd": "*", + "ext-iconv": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-simplexml": "*", + "ext-xml": "*", + "ext-xmlreader": "*", + "ext-xmlwriter": "*", + "ext-zip": "*", + "ext-zlib": "*", + "maennchen/zipstream-php": "^2.1 || ^3.0", + "markbaker/complex": "^3.0", + "markbaker/matrix": "^3.0", + "php": "^8.1", + "psr/simple-cache": "^1.0 || ^2.0 || ^3.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-main", + "dompdf/dompdf": "^2.0 || ^3.0", + "ext-intl": "*", + "friendsofphp/php-cs-fixer": "^3.2", + "mitoteam/jpgraph": "^10.5", + "mpdf/mpdf": "^8.1.1", + "phpcompatibility/php-compatibility": "^9.3", + "phpstan/phpstan": "^1.1 || ^2.0", + "phpstan/phpstan-deprecation-rules": "^1.0 || ^2.0", + "phpstan/phpstan-phpunit": "^1.0 || ^2.0", + "phpunit/phpunit": "^10.5", + "squizlabs/php_codesniffer": "^3.7", + "tecnickcom/tcpdf": "^6.5" + }, + "suggest": { + "dompdf/dompdf": "Option for rendering PDF with PDF Writer", + "ext-intl": "PHP Internationalization Functions, required for NumberFormat Wizard and StringHelper::setLocale()", + "mitoteam/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers", + "mpdf/mpdf": "Option for rendering PDF with PDF Writer", + "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "https://blog.maartenballiauw.be" + }, + { + "name": "Mark Baker", + "homepage": "https://markbakeruk.net" + }, + { + "name": "Franck Lefevre", + "homepage": "https://rootslabs.net" + }, + { + "name": "Erik Tilt" + }, + { + "name": "Adrien Crivelli" + }, + { + "name": "Owen Leibman" + } + ], + "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", + "keywords": [ + "OpenXML", + "excel", + "gnumeric", + "ods", + "php", + "spreadsheet", + "xls", + "xlsx" + ], + "support": { + "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/5.4.0" + }, + "time": "2026-01-11T04:52:00+00:00" + }, { "name": "psr/http-message", "version": "2.0", @@ -8669,6 +9132,57 @@ }, "time": "2023-04-04T09:54:51+00:00" }, + { + "name": "psr/simple-cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865", + "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "support": { + "source": "https://github.com/php-fig/simple-cache/tree/3.0.0" + }, + "time": "2021-10-29T13:26:27+00:00" + }, { "name": "react/cache", "version": "v1.2.0", @@ -10141,7 +10655,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { @@ -10149,6 +10663,6 @@ "ext-ctype": "*", "ext-iconv": "*" }, - "platform-dev": {}, + "platform-dev": [], "plugin-api-version": "2.6.0" } diff --git a/api-platform/api/config/bundles.php b/api-platform/api/config/bundles.php index e33ab8c484fbec7509375faefbc754635b35652d..7c3f10225929a4c11c2d0b461a63f510b79edbf7 100644 --- a/api-platform/api/config/bundles.php +++ b/api-platform/api/config/bundles.php @@ -13,4 +13,5 @@ return [ Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true], + Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true], ]; diff --git a/api-platform/api/migrations/Version20240307125735.php b/api-platform/api/migrations/Version20240307125735.php index bb7bce8f362c5f6ac6a151ca8cab26d6805f380c..2195b2de046196f1c91c833672b0e3ae38760cee 100644 --- a/api-platform/api/migrations/Version20240307125735.php +++ b/api-platform/api/migrations/Version20240307125735.php @@ -27,7 +27,7 @@ final class Version20240307125735 extends AbstractMigration public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs - $this->addSql('CREATE SCHEMA public'); + // $this->addSql('CREATE SCHEMA public'); $this->addSql('DROP SEQUENCE greeting_id_seq CASCADE'); $this->addSql('DROP TABLE greeting'); } diff --git a/api-platform/api/migrations/Version20260114152959.php b/api-platform/api/migrations/Version20260114152959.php new file mode 100644 index 0000000000000000000000000000000000000000..fb116ee5093b9ac6efe20fcf56f4b3e79364c07a --- /dev/null +++ b/api-platform/api/migrations/Version20260114152959.php @@ -0,0 +1,55 @@ +addSql('DROP SEQUENCE greeting_id_seq CASCADE'); + $this->addSql('CREATE TABLE commune (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, nom VARCHAR(255) NOT NULL, departement_id INT NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_E2E2D1EECCF9E01E ON commune (departement_id)'); + $this->addSql('CREATE TABLE departement (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, code INT NOT NULL, region_id INT NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_C1765B6398260155 ON departement (region_id)'); + $this->addSql('CREATE TABLE region (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, nom VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE taxe (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, annee INT NOT NULL, taux DOUBLE PRECISION NOT NULL, volume DOUBLE PRECISION NOT NULL, commune_id INT NOT NULL, type_id INT NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_56322FE9131A4F72 ON taxe (commune_id)'); + $this->addSql('CREATE INDEX IDX_56322FE9C54C8C93 ON taxe (type_id)'); + $this->addSql('CREATE TABLE type_taxe (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, code VARCHAR(5) NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('ALTER TABLE commune ADD CONSTRAINT FK_E2E2D1EECCF9E01E FOREIGN KEY (departement_id) REFERENCES departement (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE departement ADD CONSTRAINT FK_C1765B6398260155 FOREIGN KEY (region_id) REFERENCES region (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE taxe ADD CONSTRAINT FK_56322FE9131A4F72 FOREIGN KEY (commune_id) REFERENCES commune (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE taxe ADD CONSTRAINT FK_56322FE9C54C8C93 FOREIGN KEY (type_id) REFERENCES type_taxe (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('DROP TABLE greeting'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SEQUENCE greeting_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE TABLE greeting (id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('ALTER TABLE commune DROP CONSTRAINT FK_E2E2D1EECCF9E01E'); + $this->addSql('ALTER TABLE departement DROP CONSTRAINT FK_C1765B6398260155'); + $this->addSql('ALTER TABLE taxe DROP CONSTRAINT FK_56322FE9131A4F72'); + $this->addSql('ALTER TABLE taxe DROP CONSTRAINT FK_56322FE9C54C8C93'); + $this->addSql('DROP TABLE commune'); + $this->addSql('DROP TABLE departement'); + $this->addSql('DROP TABLE region'); + $this->addSql('DROP TABLE taxe'); + $this->addSql('DROP TABLE type_taxe'); + } +} diff --git a/api-platform/api/migrations/Version20260116134143.php b/api-platform/api/migrations/Version20260116134143.php new file mode 100644 index 0000000000000000000000000000000000000000..3a7e747962f84b41dd13d26cfe247dae9226c6d1 --- /dev/null +++ b/api-platform/api/migrations/Version20260116134143.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE commune ADD code INT NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE commune DROP code'); + } +} diff --git a/api-platform/api/migrations/Version20260116134910.php b/api-platform/api/migrations/Version20260116134910.php new file mode 100644 index 0000000000000000000000000000000000000000..6abfab472dec49d5515cf83bebc0afd8562374d1 --- /dev/null +++ b/api-platform/api/migrations/Version20260116134910.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE departement ADD nom VARCHAR(255) NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE departement DROP nom'); + } +} diff --git a/api-platform/api/src/DataFixtures/AppFixtures.php b/api-platform/api/src/DataFixtures/AppFixtures.php new file mode 100644 index 0000000000000000000000000000000000000000..7e9f4189a5e093ec91bc944ea18e340370f7d173 --- /dev/null +++ b/api-platform/api/src/DataFixtures/AppFixtures.php @@ -0,0 +1,290 @@ +loadCsv($manager); + + $manager->flush(); + + ini_set('memory_limit', '1024M'); + } + + public function loadCsv(ObjectManager $manager): void { + // $pool = new ApcuCachePool(); + // $simpleCache = new SimpleCacheBridge($pool); + + // \PhpOffice\PhpSpreadsheet\Settings::setCache($simpleCache); + + $typeTFPNB = $this->typeTaxeService->findOneByCode(TypeTaxe::TFPNB_CODE); + $typeTFPB = $this->typeTaxeService->findOneByCode(TypeTaxe::TFPB_CODE); + $typeTH = $this->typeTaxeService->findOneByCode(TypeTaxe::TH_CODE); + $typeCFE = $this->typeTaxeService->findOneByCode(TypeTaxe::CFE_CODE); + + if(is_null($typeTFPNB)) { + $typeTFPNB = new TypeTaxe(); + $typeTFPNB->setCode(TypeTaxe::TFPNB_CODE); + $typeTFPNB->setLabel("Taxe foncière sur les propriétés non bâties"); + + $manager->persist($typeTFPNB); + } + if(is_null($typeTFPB)) { + $typeTFPB = new TypeTaxe(); + $typeTFPB->setCode(TypeTaxe::TFPB_CODE); + $typeTFPB->setLabel("Taxe foncière sur les propriétés bâties"); + + $manager->persist($typeTFPB); + } + if(is_null($typeTH)) { + $typeTH = new TypeTaxe(); + $typeTH->setCode(TypeTaxe::TH_CODE); + $typeTH->setLabel("Taxe d'habitation"); + + $manager->persist($typeTH); + } + if(is_null($typeCFE)) { + $typeCFE = new TypeTaxe(); + $typeCFE->setCode(TypeTaxe::CFE_CODE); + $typeCFE->setLabel("Cotisation foncière des entreprises"); + + $manager->persist($typeCFE); + } + + foreach (self::DATA_FILES as $path) { + $explodedPath = explode('_', str_replace('.csv', '', $path)); + $annee = intval(end($explodedPath)); + + $depNumCol = null; + $depNomCol = null; + $regNomCol = null; + $comNumCol = null; + $comNomCol = null; + $tauxTFPNBCol = null; + $volTFPNBCol = null; + $tauxTFPBCol = null; + $volTFPBCol = null; + $tauxTHCol = null; + $volTHCol = null; + $tauxCFECol = null; + $volCFECol = null; + + $colsFound = false; + + switch ($annee) { + case 2018: + $colsFound = true; + + $depNumCol = 1; + $depNomCol = 935; + $regNomCol = 936; + $comNumCol = 3; + $comNomCol = 10; + $tauxTFPNBCol = 13; + $volTFPNBCol = 14; + $tauxTFPBCol = 68; + $volTFPBCol = 69; + $tauxTHCol = 167; + $volTHCol = 168; + $tauxCFECol = 327; + $volCFECol = 328; + break; + case 2019: + $colsFound = true; + + $depNumCol = 1; + $depNomCol = 935; + $regNomCol = 936; + $comNumCol = 3; + $comNomCol = 10; + $tauxTFPNBCol = 13; + $volTFPNBCol = 14; + $tauxTFPBCol = 68; + $volTFPBCol = 69; + $tauxTHCol = 167; + $volTHCol = 168; + $tauxCFECol = 327; + $volCFECol = 328; + break; + case 2020: + $colsFound = true; + + $depNumCol = 1; + $depNomCol = 1066; + $regNomCol = 1067; + $comNumCol = 3; + $comNomCol = 10; + $tauxTFPNBCol = 13; + $volTFPNBCol = 14; + $tauxTFPBCol = 68; + $volTFPBCol = 69; + $tauxTHCol = 185; + $volTHCol = 186; + $tauxCFECol = 347; + $volCFECol = 348; + break; + case 2021: + $colsFound = true; + + $depNumCol = 1; + $depNomCol = 1108; + $regNomCol = 1109; + $comNumCol = 3; + $comNomCol = 10; + $tauxTFPNBCol = 13; + $volTFPNBCol = 14; + $tauxTFPBCol = 68; + $volTFPBCol = 69; + $tauxTHCol = 171; + $volTHCol = 172; + $tauxCFECol = 322; + $volCFECol = 323; + break; + case 2022: + $colsFound = true; + + $depNumCol = 1; + $depNomCol = 1145; + $regNomCol = 1146; + $comNumCol = 3; + $comNomCol = 10; + $tauxTFPNBCol = 13; + $volTFPNBCol = 14; + $tauxTFPBCol = 68; + $volTFPBCol = 69; + $tauxTHCol = 175; + $volTHCol = 176; + $tauxCFECol = 332; + $volCFECol = 333; + break; + } + + if (!$colsFound) { + continue; + } + + $titleLine = true; + if (($handle = fopen($path, "r")) !== FALSE) { + while (($data = fgetcsv($handle, separator: ",")) !== FALSE) { + if ($titleLine) { + $titleLine = false; + continue; + } + + $depNum = intval($data[$depNumCol - 1] ?? null); + $depNom = $data[$depNomCol - 1] ?? null; + $regNom = $data[$regNomCol - 1] ?? null; + $comNum = intval($data[$comNumCol - 1] ?? null); + $comNom = $data[$comNomCol - 1] ?? null; + $tauxTFPNB = floatval($data[$tauxTFPNBCol - 1] ?? null); + $volTFPNB = floatval($data[$volTFPNBCol - 1] ?? null); + $tauxTFPB = floatval($data[$tauxTFPBCol - 1] ?? null); + $volTFPB = floatval($data[$volTFPBCol - 1] ?? null); + $tauxTH = floatval($data[$tauxTHCol - 1] ?? null); + $volTH = floatval($data[$volTHCol - 1] ?? null); + $tauxCFE = floatval($data[$tauxCFECol - 1] ?? null); + $volCFE = floatval($data[$volCFECol - 1] ?? null); + + $args = [ + $depNum, $depNom, $regNom, $comNum, $comNom, $tauxTFPNB, $volTFPNB, + $tauxTFPB, $volTFPB, $tauxTH, $volTH, $tauxCFE, $volCFE + ]; + + if(in_array(null, $args)) { continue; } + + $departement = $this->departementService->findOneByCode($depNum); + $commune = $this->communeService->findOneByCode($comNum); + + if(is_null($departement)) { + $region = $this->regionService->findOneByNom($regNom); + + if(is_null($region)) { + $region = new Region(); + $region->setNom($regNom); + + $manager->persist($region); + $manager->flush(); + $region = $this->regionService->findOneByNom($regNom); + } + + $departement = new Departement(); + $departement->setCode($depNum); + $departement->setNom($depNom); + $departement->setRegion($region); + + $manager->persist($departement); + $manager->flush(); + $departement = $this->departementService->findOneByCode($depNum); + } + + if (is_null($commune)) { + $commune = new Commune(); + $commune->setCode($comNum); + $commune->setNom($comNom); + $commune->setDepartement($departement); + + $manager->persist($commune); + $manager->flush(); + $commune = $this->communeService->findOneByCode($comNum); + } + + + $taxeTFPNB = new Taxe(); + $taxeTFPNB->setType($typeTFPNB); + $taxeTFPNB->setCommune($commune); + $taxeTFPNB->setTaux($tauxTFPNB); + $taxeTFPNB->setVolume($volTFPNB); + + $taxeTFPB = new Taxe(); + $taxeTFPB->setType($typeTFPB); + $taxeTFPB->setCommune($commune); + $taxeTFPB->setTaux($tauxTFPB); + $taxeTFPB->setVolume($volTFPB); + + $taxeTH = new Taxe(); + $taxeTH->setType($typeTH); + $taxeTH->setCommune($commune); + $taxeTH->setTaux($tauxTH); + $taxeTH->setVolume($volTH); + + $taxeCFE = new Taxe(); + $taxeCFE->setType($typeCFE); + $taxeCFE->setCommune($commune); + $taxeCFE->setTaux($tauxCFE); + $taxeCFE->setVolume($volCFE); + } + fclose($handle); + } + } + } +} diff --git a/api-platform/api/src/Entity/Commune.php b/api-platform/api/src/Entity/Commune.php index addaa553cec69460adb63b11aedad76e59c33a20..666bc3f530932c939b1abe52e83f30aca06bfd0f 100644 --- a/api-platform/api/src/Entity/Commune.php +++ b/api-platform/api/src/Entity/Commune.php @@ -17,6 +17,9 @@ class Commune #[ORM\Column] private ?int $id = null; + #[ORM\Column] + private ?int $code = null; + #[ORM\Column(length: 255)] private ?string $nom = null; @@ -100,4 +103,16 @@ class Commune return $this; } + + public function getCode(): ?int + { + return $this->code; + } + + public function setCode(int $code): static + { + $this->code = $code; + + return $this; + } } diff --git a/api-platform/api/src/Entity/Departement.php b/api-platform/api/src/Entity/Departement.php index 6c40eda06711f1ad9f8442bf6a64a23c3e1f6fee..dd61c5f63b01c5d417c4e92b100e00af148490e1 100644 --- a/api-platform/api/src/Entity/Departement.php +++ b/api-platform/api/src/Entity/Departement.php @@ -20,6 +20,9 @@ class Departement #[ORM\Column] private ?int $code = null; + #[ORM\Column(length: 255)] + private ?string $nom = null; + #[ORM\ManyToOne(inversedBy: 'departements')] #[ORM\JoinColumn(nullable: false)] private ?Region $region = null; @@ -93,4 +96,16 @@ class Departement return $this; } + + public function getNom(): ?string + { + return $this->nom; + } + + public function setNom(string $nom): static + { + $this->nom = $nom; + + return $this; + } } diff --git a/api-platform/api/src/Entity/TypeTaxe.php b/api-platform/api/src/Entity/TypeTaxe.php index 02f89b8412e7555ec54718c4cb80d9a6edccf137..03f76a3e9432d7e234be2792082d9067c368aa54 100644 --- a/api-platform/api/src/Entity/TypeTaxe.php +++ b/api-platform/api/src/Entity/TypeTaxe.php @@ -12,6 +12,11 @@ use Doctrine\ORM\Mapping as ORM; #[ApiResource] class TypeTaxe { + public const TFPNB_CODE = 'TFPNB'; + public const TFPB_CODE = 'TFPB'; + public const TH_CODE = 'TH'; + public const CFE_CODE = 'CFE'; + #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] diff --git a/api-platform/api/src/Repository/CommuneRepository.php b/api-platform/api/src/Repository/CommuneRepository.php index 393ffd5a31e4e90de64cae11f395d56aae9a91ed..9bd4ecc3396525c67281a3ced612959ecb5bb5c5 100644 --- a/api-platform/api/src/Repository/CommuneRepository.php +++ b/api-platform/api/src/Repository/CommuneRepository.php @@ -31,13 +31,13 @@ class CommuneRepository extends ServiceEntityRepository // ; // } -// public function findOneBySomeField($value): ?Commune -// { -// return $this->createQueryBuilder('c') -// ->andWhere('c.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } + public function findOneByCode($value): ?Commune + { + return $this->createQueryBuilder('c') + ->andWhere('c.code = :val') + ->setParameter('val', $value) + ->getQuery() + ->getOneOrNullResult() + ; + } } diff --git a/api-platform/api/src/Repository/DepartementRepository.php b/api-platform/api/src/Repository/DepartementRepository.php index 2cd358112acaca5416eb2866d30bb77847aa948f..20f047c8552766d88b55b64050acf0317bcd9225 100644 --- a/api-platform/api/src/Repository/DepartementRepository.php +++ b/api-platform/api/src/Repository/DepartementRepository.php @@ -31,13 +31,13 @@ class DepartementRepository extends ServiceEntityRepository // ; // } - // public function findOneBySomeField($value): ?Departement - // { - // return $this->createQueryBuilder('d') - // ->andWhere('d.exampleField = :val') - // ->setParameter('val', $value) - // ->getQuery() - // ->getOneOrNullResult() - // ; - // } + public function findOneByCode($value): ?Departement + { + return $this->createQueryBuilder('d') + ->andWhere('d.code = :val') + ->setParameter('val', $value) + ->getQuery() + ->getOneOrNullResult() + ; + } } diff --git a/api-platform/api/src/Repository/RegionRepository.php b/api-platform/api/src/Repository/RegionRepository.php index 83e6a387e495aa36c86d5df1f0932f0bb7f19fe1..c09823f9358a6ed5770567095c0d06d412fc6f21 100644 --- a/api-platform/api/src/Repository/RegionRepository.php +++ b/api-platform/api/src/Repository/RegionRepository.php @@ -31,13 +31,13 @@ class RegionRepository extends ServiceEntityRepository // ; // } - // public function findOneBySomeField($value): ?Region - // { - // return $this->createQueryBuilder('r') - // ->andWhere('r.exampleField = :val') - // ->setParameter('val', $value) - // ->getQuery() - // ->getOneOrNullResult() - // ; - // } + public function findOneByNom($value): ?Region + { + return $this->createQueryBuilder('r') + ->andWhere('r.nom = :val') + ->setParameter('val', $value) + ->getQuery() + ->getOneOrNullResult() + ; + } } diff --git a/api-platform/api/src/Repository/TypeTaxeRepository.php b/api-platform/api/src/Repository/TypeTaxeRepository.php index d42be41e10dd5070bb29bde1ddc450e1922f2314..910e78e92332f74078f301117bce1ce11cdfe9eb 100644 --- a/api-platform/api/src/Repository/TypeTaxeRepository.php +++ b/api-platform/api/src/Repository/TypeTaxeRepository.php @@ -31,13 +31,13 @@ class TypeTaxeRepository extends ServiceEntityRepository // ; // } - // public function findOneBySomeField($value): ?TypeTaxe - // { - // return $this->createQueryBuilder('t') - // ->andWhere('t.exampleField = :val') - // ->setParameter('val', $value) - // ->getQuery() - // ->getOneOrNullResult() - // ; - // } + public function findOneByCode($value): ?TypeTaxe + { + return $this->createQueryBuilder('t') + ->andWhere('t.code = :val') + ->setParameter('val', $value) + ->getQuery() + ->getOneOrNullResult() + ; + } } diff --git a/api-platform/api/src/Service/.gitignore b/api-platform/api/src/Service/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/api-platform/api/src/Service/CommuneService.php b/api-platform/api/src/Service/CommuneService.php new file mode 100644 index 0000000000000000000000000000000000000000..ecd3100cf1be9339fe2698046384bdd17a828991 --- /dev/null +++ b/api-platform/api/src/Service/CommuneService.php @@ -0,0 +1,17 @@ +communeRepository->findOneByCode($value); + } +} diff --git a/api-platform/api/src/Service/DepartementService.php b/api-platform/api/src/Service/DepartementService.php new file mode 100644 index 0000000000000000000000000000000000000000..ebec2205aa1cd8d59247eb4a642ed900d976770b --- /dev/null +++ b/api-platform/api/src/Service/DepartementService.php @@ -0,0 +1,19 @@ +departementRepository->findOneByCode($value); + } +} diff --git a/api-platform/api/src/Service/RegionService.php b/api-platform/api/src/Service/RegionService.php new file mode 100644 index 0000000000000000000000000000000000000000..f02dcbd479ee44638d6d47f06892bbe1be363840 --- /dev/null +++ b/api-platform/api/src/Service/RegionService.php @@ -0,0 +1,18 @@ +regionRepository->findOneByNom($value); + } +} diff --git a/api-platform/api/src/Service/TaxeService.php b/api-platform/api/src/Service/TaxeService.php new file mode 100644 index 0000000000000000000000000000000000000000..f8417956b477695c0b57a4d7d0789013cda38827 --- /dev/null +++ b/api-platform/api/src/Service/TaxeService.php @@ -0,0 +1,13 @@ +typeTaxeRepository->findOneByCode($value); + } +} diff --git a/api-platform/api/symfony.lock b/api-platform/api/symfony.lock index dbff2913ee5e51eb535f8b66ee2d0afaad689300..268f2b093cff84c1ca68b237af40b0fbcc14353f 100644 --- a/api-platform/api/symfony.lock +++ b/api-platform/api/symfony.lock @@ -13,6 +13,15 @@ "src/ApiResource/.gitignore" ] }, + "doctrine/deprecations": { + "version": "1.1", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "1.0", + "ref": "87424683adc81d7dc305eefec1fced883084aab9" + } + }, "doctrine/doctrine-bundle": { "version": "2.13", "recipe": { @@ -27,6 +36,18 @@ "src/Repository/.gitignore" ] }, + "doctrine/doctrine-fixtures-bundle": { + "version": "4.3", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "3.0", + "ref": "1f5514cfa15b947298df4d771e694e578d4c204d" + }, + "files": [ + "./src/DataFixtures/AppFixtures.php" + ] + }, "doctrine/doctrine-migrations-bundle": { "version": "3.3", "recipe": {