From 730906df32287a816471d1abd7b53f6e3804ca8d Mon Sep 17 00:00:00 2001 From: Rodrigo Werlich Date: Tue, 21 Jun 2022 17:50:47 -0300 Subject: [PATCH 01/18] ignore --- .gitignore | 2 ++ composer.json | 0 2 files changed, 2 insertions(+) create mode 100644 .gitignore create mode 100644 composer.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..331c58f73 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea +vendor \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 000000000..e69de29bb From a1ffb53d8e61f525c26c54b0545e93ee4eca167c Mon Sep 17 00:00:00 2001 From: Rodrigo Werlich Date: Tue, 21 Jun 2022 17:51:05 -0300 Subject: [PATCH 02/18] composer --- composer.json | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/composer.json b/composer.json index e69de29bb..d3e86447b 100644 --- a/composer.json +++ b/composer.json @@ -0,0 +1,21 @@ +{ + "config": { + "platform": { + "php": "8.1" + } + }, + "require": { + "php": ">=8.1", + "slim/slim": "3.*", + "doctrine/orm": "^2.11", + "doctrine/dbal": "^3.3", + "doctrine/annotations": "^1.13", + "symfony/yaml": "^6.0", + "symfony/cache": "^6.0" + }, + "autoload": { + "psr-4": { + "App\\": "./src" + } + } +} From 143cb8c4ff1c22fbd9d126512be4353e354dc177 Mon Sep 17 00:00:00 2001 From: Rodrigo Werlich Date: Tue, 21 Jun 2022 17:53:49 -0300 Subject: [PATCH 03/18] cli doctrine --- .htaccess | 0 cli-config.php | 3 +++ 2 files changed, 3 insertions(+) create mode 100644 .htaccess create mode 100644 cli-config.php diff --git a/.htaccess b/.htaccess new file mode 100644 index 000000000..e69de29bb diff --git a/cli-config.php b/cli-config.php new file mode 100644 index 000000000..8b37e0261 --- /dev/null +++ b/cli-config.php @@ -0,0 +1,3 @@ + Date: Tue, 21 Jun 2022 18:10:47 -0300 Subject: [PATCH 04/18] dependencias --- composer.lock | 2554 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2554 insertions(+) create mode 100644 composer.lock diff --git a/composer.lock b/composer.lock new file mode 100644 index 000000000..23137bdbf --- /dev/null +++ b/composer.lock @@ -0,0 +1,2554 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "161bbb742f338a0fab71d6a867dbb326", + "packages": [ + { + "name": "doctrine/annotations", + "version": "1.13.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "5b668aef16090008790395c02c893b1ba13f7e08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/5b668aef16090008790395c02c893b1ba13f7e08", + "reference": "5b668aef16090008790395c02c893b1ba13f7e08", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "ext-tokenizer": "*", + "php": "^7.1 || ^8.0", + "psr/cache": "^1 || ^2 || ^3" + }, + "require-dev": { + "doctrine/cache": "^1.11 || ^2.0", + "doctrine/coding-standard": "^6.0 || ^8.1", + "phpstan/phpstan": "^0.12.20", + "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", + "symfony/cache": "^4.4 || ^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "https://www.doctrine-project.org/projects/annotations.html", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "support": { + "issues": "https://github.com/doctrine/annotations/issues", + "source": "https://github.com/doctrine/annotations/tree/1.13.2" + }, + "time": "2021-08-05T19:00:23+00:00" + }, + { + "name": "doctrine/cache", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", + "shasum": "" + }, + "require": { + "php": "~7.1 || ^8.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "cache/integration-tests": "dev-master", + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psr/cache": "^1.0 || ^2.0 || ^3.0", + "symfony/cache": "^4.4 || ^5.4 || ^6", + "symfony/var-exporter": "^4.4 || ^5.4 || ^6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", + "homepage": "https://www.doctrine-project.org/projects/cache.html", + "keywords": [ + "abstraction", + "apcu", + "cache", + "caching", + "couchdb", + "memcached", + "php", + "redis", + "xcache" + ], + "support": { + "issues": "https://github.com/doctrine/cache/issues", + "source": "https://github.com/doctrine/cache/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%2Fcache", + "type": "tidelift" + } + ], + "time": "2022-05-20T20:07:39+00:00" + }, + { + "name": "doctrine/collections", + "version": "1.6.8", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "1958a744696c6bb3bb0d28db2611dc11610e78af" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/1958a744696c6bb3bb0d28db2611dc11610e78af", + "reference": "1958a744696c6bb3bb0d28db2611dc11610e78af", + "shasum": "" + }, + "require": { + "php": "^7.1.3 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.1.5", + "vimeo/psalm": "^4.2.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Collections\\": "lib/Doctrine/Common/Collections" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.", + "homepage": "https://www.doctrine-project.org/projects/collections.html", + "keywords": [ + "array", + "collections", + "iterators", + "php" + ], + "support": { + "issues": "https://github.com/doctrine/collections/issues", + "source": "https://github.com/doctrine/collections/tree/1.6.8" + }, + "time": "2021-08-10T18:51:53+00:00" + }, + { + "name": "doctrine/common", + "version": "3.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "c824e95d4c83b7102d8bc60595445a6f7d540f96" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/c824e95d4c83b7102d8bc60595445a6f7d540f96", + "reference": "c824e95d4c83b7102d8bc60595445a6f7d540f96", + "shasum": "" + }, + "require": { + "doctrine/persistence": "^2.0 || ^3.0", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "^1.4.1", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5.20 || ^8.5 || ^9.0", + "squizlabs/php_codesniffer": "^3.0", + "symfony/phpunit-bridge": "^4.0.5", + "vimeo/psalm": "^4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, proxies and much more.", + "homepage": "https://www.doctrine-project.org/projects/common.html", + "keywords": [ + "common", + "doctrine", + "php" + ], + "support": { + "issues": "https://github.com/doctrine/common/issues", + "source": "https://github.com/doctrine/common/tree/3.3.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%2Fcommon", + "type": "tidelift" + } + ], + "time": "2022-02-05T18:28:51+00:00" + }, + { + "name": "doctrine/dbal", + "version": "3.3.7", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "9f79d4650430b582f4598fe0954ef4d52fbc0a8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/9f79d4650430b582f4598fe0954ef4d52fbc0a8a", + "reference": "9f79d4650430b582f4598fe0954ef4d52fbc0a8a", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2", + "doctrine/cache": "^1.11|^2.0", + "doctrine/deprecations": "^0.5.3|^1", + "doctrine/event-manager": "^1.0", + "php": "^7.3 || ^8.0", + "psr/cache": "^1|^2|^3", + "psr/log": "^1|^2|^3" + }, + "require-dev": { + "doctrine/coding-standard": "9.0.0", + "jetbrains/phpstorm-stubs": "2022.1", + "phpstan/phpstan": "1.7.13", + "phpstan/phpstan-strict-rules": "^1.2", + "phpunit/phpunit": "9.5.20", + "psalm/plugin-phpunit": "0.16.1", + "squizlabs/php_codesniffer": "3.7.0", + "symfony/cache": "^5.2|^6.0", + "symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0", + "vimeo/psalm": "4.23.0" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\DBAL\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.", + "homepage": "https://www.doctrine-project.org/projects/dbal.html", + "keywords": [ + "abstraction", + "database", + "db2", + "dbal", + "mariadb", + "mssql", + "mysql", + "oci8", + "oracle", + "pdo", + "pgsql", + "postgresql", + "queryobject", + "sasql", + "sql", + "sqlite", + "sqlserver", + "sqlsrv" + ], + "support": { + "issues": "https://github.com/doctrine/dbal/issues", + "source": "https://github.com/doctrine/dbal/tree/3.3.7" + }, + "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%2Fdbal", + "type": "tidelift" + } + ], + "time": "2022-06-13T21:43:03+00:00" + }, + { + "name": "doctrine/deprecations", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "shasum": "" + }, + "require": { + "php": "^7.1|^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" + }, + "time": "2022-05-02T15:47:09+00:00" + }, + { + "name": "doctrine/event-manager", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/event-manager.git", + "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f", + "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/common": "<2.9@dev" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", + "homepage": "https://www.doctrine-project.org/projects/event-manager.html", + "keywords": [ + "event", + "event dispatcher", + "event manager", + "event system", + "events" + ], + "support": { + "issues": "https://github.com/doctrine/event-manager/issues", + "source": "https://github.com/doctrine/event-manager/tree/1.1.x" + }, + "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%2Fevent-manager", + "type": "tidelift" + } + ], + "time": "2020-05-29T18:28:51+00:00" + }, + { + "name": "doctrine/inflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^8.2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "vimeo/psalm": "^4.10" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", + "homepage": "https://www.doctrine-project.org/projects/inflector.html", + "keywords": [ + "inflection", + "inflector", + "lowercase", + "manipulation", + "php", + "plural", + "singular", + "strings", + "uppercase", + "words" + ], + "support": { + "issues": "https://github.com/doctrine/inflector/issues", + "source": "https://github.com/doctrine/inflector/tree/2.0.4" + }, + "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%2Finflector", + "type": "tidelift" + } + ], + "time": "2021-10-22T20:16:43+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.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%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-03-03T08:28:38+00:00" + }, + { + "name": "doctrine/lexer", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "keywords": [ + "annotations", + "docblock", + "lexer", + "parser", + "php" + ], + "support": { + "issues": "https://github.com/doctrine/lexer/issues", + "source": "https://github.com/doctrine/lexer/tree/1.2.3" + }, + "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%2Flexer", + "type": "tidelift" + } + ], + "time": "2022-02-28T11:07:21+00:00" + }, + { + "name": "doctrine/orm", + "version": "2.12.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/orm.git", + "reference": "c05e1709e9ffb9abe8d37260a78975cc816ee385" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/orm/zipball/c05e1709e9ffb9abe8d37260a78975cc816ee385", + "reference": "c05e1709e9ffb9abe8d37260a78975cc816ee385", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2", + "doctrine/cache": "^1.12.1 || ^2.1.1", + "doctrine/collections": "^1.5", + "doctrine/common": "^3.0.3", + "doctrine/dbal": "^2.13.1 || ^3.2", + "doctrine/deprecations": "^0.5.3 || ^1", + "doctrine/event-manager": "^1.1", + "doctrine/inflector": "^1.4 || ^2.0", + "doctrine/instantiator": "^1.3", + "doctrine/lexer": "^1.2.3", + "doctrine/persistence": "^2.4 || ^3", + "ext-ctype": "*", + "php": "^7.1 || ^8.0", + "psr/cache": "^1 || ^2 || ^3", + "symfony/console": "^3.0 || ^4.0 || ^5.0 || ^6.0", + "symfony/polyfill-php72": "^1.23", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "doctrine/annotations": "<1.13 || >= 2.0" + }, + "require-dev": { + "doctrine/annotations": "^1.13", + "doctrine/coding-standard": "^9.0", + "phpbench/phpbench": "^0.16.10 || ^1.0", + "phpstan/phpstan": "~1.4.10 || 1.7.13", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psr/log": "^1 || ^2 || ^3", + "squizlabs/php_codesniffer": "3.7.0", + "symfony/cache": "^4.4 || ^5.4 || ^6.0", + "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0", + "vimeo/psalm": "4.23.0" + }, + "suggest": { + "symfony/cache": "Provides cache support for Setup Tool with doctrine/cache 2.0", + "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" + }, + "bin": [ + "bin/doctrine" + ], + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\ORM\\": "lib/Doctrine/ORM" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "Object-Relational-Mapper for PHP", + "homepage": "https://www.doctrine-project.org/projects/orm.html", + "keywords": [ + "database", + "orm" + ], + "support": { + "issues": "https://github.com/doctrine/orm/issues", + "source": "https://github.com/doctrine/orm/tree/2.12.3" + }, + "time": "2022-06-16T13:42:23+00:00" + }, + { + "name": "doctrine/persistence", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/persistence.git", + "reference": "25ec98a8cbd1f850e60fdb62c0ef77c162da8704" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/persistence/zipball/25ec98a8cbd1f850e60fdb62c0ef77c162da8704", + "reference": "25ec98a8cbd1f850e60fdb62c0ef77c162da8704", + "shasum": "" + }, + "require": { + "doctrine/collections": "^1.0", + "doctrine/event-manager": "^1.0", + "php": "^7.2 || ^8.0", + "psr/cache": "^1.0 || ^2.0 || ^3.0" + }, + "conflict": { + "doctrine/annotations": "<1.7 || >=2.0", + "doctrine/common": "<2.10" + }, + "require-dev": { + "composer/package-versions-deprecated": "^1.11", + "doctrine/annotations": "^1.7", + "doctrine/coding-standard": "^9.0", + "doctrine/common": "^3.0", + "phpstan/phpstan": "1.5.0", + "phpstan/phpstan-phpunit": "^1", + "phpstan/phpstan-strict-rules": "^1.1", + "phpunit/phpunit": "^8.5 || ^9.5", + "symfony/cache": "^4.4 || ^5.4 || ^6.0", + "vimeo/psalm": "4.22.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Persistence\\": "src/Persistence" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.", + "homepage": "https://www.doctrine-project.org/projects/persistence.html", + "keywords": [ + "mapper", + "object", + "odm", + "orm", + "persistence" + ], + "support": { + "issues": "https://github.com/doctrine/persistence/issues", + "source": "https://github.com/doctrine/persistence/tree/3.0.2" + }, + "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%2Fpersistence", + "type": "tidelift" + } + ], + "time": "2022-05-06T06:10:05+00:00" + }, + { + "name": "nikic/fast-route", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/FastRoute.git", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|~5.7" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "FastRoute\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov", + "email": "nikic@php.net" + } + ], + "description": "Fast request router for PHP", + "keywords": [ + "router", + "routing" + ], + "support": { + "issues": "https://github.com/nikic/FastRoute/issues", + "source": "https://github.com/nikic/FastRoute/tree/master" + }, + "time": "2018-02-13T20:26:39+00:00" + }, + { + "name": "pimple/pimple", + "version": "v3.5.0", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/a94b3a4db7fb774b3d78dad2315ddc07629e1bed", + "reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.1 || ^2.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^5.4@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pimple": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple, a simple Dependency Injection Container", + "homepage": "https://pimple.symfony.com", + "keywords": [ + "container", + "dependency injection" + ], + "support": { + "source": "https://github.com/silexphp/Pimple/tree/v3.5.0" + }, + "time": "2021-10-28T11:13:42+00:00" + }, + { + "name": "psr/cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/3.0.0" + }, + "time": "2021-02-03T23:26:27+00:00" + }, + { + "name": "psr/container", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "time": "2021-11-05T16:50:12+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/master" + }, + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "psr/log", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.0" + }, + "time": "2021-07-14T16:46:02+00:00" + }, + { + "name": "slim/slim", + "version": "3.12.3", + "source": { + "type": "git", + "url": "https://github.com/slimphp/Slim.git", + "reference": "1c9318a84ffb890900901136d620b4f03a59da38" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/1c9318a84ffb890900901136d620b4f03a59da38", + "reference": "1c9318a84ffb890900901136d620b4f03a59da38", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-libxml": "*", + "ext-simplexml": "*", + "nikic/fast-route": "^1.0", + "php": ">=5.5.0", + "pimple/pimple": "^3.0", + "psr/container": "^1.0", + "psr/http-message": "^1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0", + "squizlabs/php_codesniffer": "^2.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Slim\\": "Slim" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "https://joshlockhart.com" + }, + { + "name": "Andrew Smith", + "email": "a.smith@silentworks.co.uk", + "homepage": "http://silentworks.co.uk" + }, + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Gabriel Manricks", + "email": "gmanricks@me.com", + "homepage": "http://gabrielmanricks.com" + } + ], + "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", + "homepage": "https://slimframework.com", + "keywords": [ + "api", + "framework", + "micro", + "router" + ], + "support": { + "issues": "https://github.com/slimphp/Slim/issues", + "source": "https://github.com/slimphp/Slim/tree/3.x" + }, + "time": "2019-11-28T17:40:33+00:00" + }, + { + "name": "symfony/cache", + "version": "v6.1.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/cache.git", + "reference": "364fc90734230d936ac2db8e897cc03ec8497bbb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/cache/zipball/364fc90734230d936ac2db8e897cc03ec8497bbb", + "reference": "364fc90734230d936ac2db8e897cc03ec8497bbb", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/cache": "^2.0|^3.0", + "psr/log": "^1.1|^2|^3", + "symfony/cache-contracts": "^1.1.7|^2|^3", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/var-exporter": "^5.4|^6.0" + }, + "conflict": { + "doctrine/dbal": "<2.13.1", + "symfony/dependency-injection": "<5.4", + "symfony/http-kernel": "<5.4", + "symfony/var-dumper": "<5.4" + }, + "provide": { + "psr/cache-implementation": "2.0|3.0", + "psr/simple-cache-implementation": "1.0|2.0|3.0", + "symfony/cache-implementation": "1.1|2.0|3.0" + }, + "require-dev": { + "cache/integration-tests": "dev-master", + "doctrine/dbal": "^2.13.1|^3.0", + "predis/predis": "^1.1", + "psr/simple-cache": "^1.0|^2.0|^3.0", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/filesystem": "^5.4|^6.0", + "symfony/http-kernel": "^5.4|^6.0", + "symfony/messenger": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Cache\\": "" + }, + "classmap": [ + "Traits/ValueWrapper.php" + ], + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an extended PSR-6, PSR-16 (and tags) implementation", + "homepage": "https://symfony.com", + "keywords": [ + "caching", + "psr6" + ], + "support": { + "source": "https://github.com/symfony/cache/tree/v6.1.1" + }, + "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": "2022-06-06T19:15:01+00:00" + }, + { + "name": "symfony/cache-contracts", + "version": "v3.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/cache-contracts.git", + "reference": "2eab7fa459af6d75c6463e63e633b667a9b761d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/2eab7fa459af6d75c6463e63e633b667a9b761d3", + "reference": "2eab7fa459af6d75c6463e63e633b667a9b761d3", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/cache": "^3.0" + }, + "suggest": { + "symfony/cache-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.1-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Cache\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to caching", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/cache-contracts/tree/v3.1.0" + }, + "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": "2022-02-25T11:15:52+00:00" + }, + { + "name": "symfony/console", + "version": "v6.1.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "6187424023fbffcd757789aeb517c9161b1eabee" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/6187424023fbffcd757789aeb517c9161b1eabee", + "reference": "6187424023fbffcd757789aeb517c9161b1eabee", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.4|^6.0" + }, + "conflict": { + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/lock": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "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": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v6.1.1" + }, + "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": "2022-06-08T14:02:09+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918", + "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.1-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.0" + }, + "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": "2022-02-25T11:15:52+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.26.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0" + }, + "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": "2022-05-24T11:49:31+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.26.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "433d05519ce6990bf3530fba6957499d327395c2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2", + "reference": "433d05519ce6990bf3530fba6957499d327395c2", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0" + }, + "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": "2022-05-24T11:49:31+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.26.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "219aa369ceff116e673852dce47c3a41794c14bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd", + "reference": "219aa369ceff116e673852dce47c3a41794c14bd", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0" + }, + "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": "2022-05-24T11:49:31+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.26.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" + }, + "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": "2022-05-24T11:49:31+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.26.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/bf44a9fd41feaac72b074de600314a93e2ae78e2", + "reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php72/tree/v1.26.0" + }, + "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": "2022-05-24T11:49:31+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.26.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" + }, + "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": "2022-05-10T07:21:04+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.5.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c", + "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v2.5.1" + }, + "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": "2022-03-13T20:07:29+00:00" + }, + { + "name": "symfony/string", + "version": "v6.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "d3edc75baf9f1d4f94879764dda2e1ac33499529" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/d3edc75baf9f1d4f94879764dda2e1ac33499529", + "reference": "d3edc75baf9f1d4f94879764dda2e1ac33499529", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.0" + }, + "require-dev": { + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v6.1.0" + }, + "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": "2022-04-22T08:18:23+00:00" + }, + { + "name": "symfony/var-exporter", + "version": "v6.1.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-exporter.git", + "reference": "ce1452317b1210ddfe18d143fa8a09c18f034b89" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/ce1452317b1210ddfe18d143fa8a09c18f034b89", + "reference": "ce1452317b1210ddfe18d143fa8a09c18f034b89", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "symfony/var-dumper": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\VarExporter\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Allows exporting any serializable PHP data structure to plain PHP code", + "homepage": "https://symfony.com", + "keywords": [ + "clone", + "construct", + "export", + "hydrate", + "instantiate", + "serialize" + ], + "support": { + "source": "https://github.com/symfony/var-exporter/tree/v6.1.1" + }, + "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": "2022-05-27T12:58:07+00:00" + }, + { + "name": "symfony/yaml", + "version": "v6.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "84ce4f9d2d68f306f971a39d949d8f4b5550dba2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/84ce4f9d2d68f306f971a39d949d8f4b5550dba2", + "reference": "84ce4f9d2d68f306f971a39d949d8f4b5550dba2", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "symfony/console": "<5.4" + }, + "require-dev": { + "symfony/console": "^5.4|^6.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "bin": [ + "Resources/bin/yaml-lint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "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": "Loads and dumps YAML files", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/yaml/tree/v6.1.0" + }, + "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": "2022-04-15T14:25:02+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=8.1" + }, + "platform-dev": [], + "platform-overrides": { + "php": "8.1" + }, + "plugin-api-version": "2.2.0" +} From a16353c444f1aee11bdeb346ce5ab41d01bfe52a Mon Sep 17 00:00:00 2001 From: Rodrigo Werlich Date: Tue, 21 Jun 2022 18:10:56 -0300 Subject: [PATCH 05/18] configuracoes --- bootstrap.php | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 bootstrap.php diff --git a/bootstrap.php b/bootstrap.php new file mode 100644 index 000000000..44c599e13 --- /dev/null +++ b/bootstrap.php @@ -0,0 +1,87 @@ + $config[$config['environment']] +]; +define("ENV", $config['environment']); +error_reporting($configs['settings']['errorReporting']); + +$container = new \Slim\Container($configs); + +/** + * Converte os Exceptions entro da Aplicação em respostas JSON + */ +$container['errorHandler'] = function ($c) { + return function ($request, $response, $exception) use ($c) { + $statusCode = $exception->getCode() ? $exception->getCode() : 500; + return $c['response']->withStatus($statusCode) + ->withHeader('Content-Type', 'Application/json') + ->withJson(["message" => $exception->getMessage()], $statusCode); + }; +}; +/** + * Converte os Exceptions de Erros 404 - Not Found + */ +$container['notFoundHandler'] = function ($container) { + return function ($request, $response) use ($container) { + return $container['response'] + ->withStatus(404) + ->withHeader('Content-Type', 'Application/json') + ->withJson(['message' => 'Page not found']); + }; +}; +/** + * Converte os Exceptions de Erros 405 - Not Allowed + */ +$container['notAllowedHandler'] = function ($c) { + return function ($request, $response, $methods) use ($c) { + return $c['response'] + ->withStatus(405) + ->withHeader('Allow', implode(', ', $methods)) + ->withHeader('Content-Type', 'Application/json') + ->withHeader("Access-Control-Allow-Methods", implode(",", $methods)) + ->withJson(["message" => "Method not Allowed; Method must be one of: " . implode(', ', $methods)], 405); + }; +}; + +$isDevMode = $config['environment'] != 'prod'; +$isDevMode = true; +$config = Setup::createAnnotationMetadataConfiguration(array(__DIR__ . "/src/Models/Entities"), $isDevMode); +$conn = [ + 'dbname' => $configs['settings']['dbname'], + 'user' => $configs['settings']['user'], + 'password' => $configs['settings']['password'], + 'host' => $configs['settings']['host'], + 'driver' => $configs['settings']['driver'], + 'charset' => 'utf8', +]; +/** + * Cria o Entity Manager do doctrine + */ +$entityManager = EntityManager::create($conn, $config); +$conn = $entityManager->getConnection(); +$conn->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); +$config = new \Doctrine\ORM\Configuration(); +$config->addCustomDatetimeFunction('DATE', 'App\Helpers\DoctrineDate'); + +$container['em'] = $entityManager; +/** + * Carrega os Controllers pra dentro do Slim + */ +foreach (glob('src/Controllers/*.php') as $filename) { + $filename = explode('/', $filename); + $controller = str_replace('.php', '', end($filename)); + $container[$controller] = function () use ($controller, $container) { + $class = '\\App\\Controllers\\' . $controller; + return new $class($container['em'], $container['renderer']); + }; +} +$app = new \Slim\App($container); +//forçar barra no final +$_SERVER["REQUEST_URI"] = substr($_SERVER["REQUEST_URI"], -1) == '/' ? $_SERVER["REQUEST_URI"] : $_SERVER["REQUEST_URI"] . '/'; From 0ccbea40bb017c1b1834935f73e98edb36235a63 Mon Sep 17 00:00:00 2001 From: Rodrigo Werlich Date: Tue, 21 Jun 2022 18:12:27 -0300 Subject: [PATCH 06/18] index do projeto - carrega as rotas --- index.php | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 index.php diff --git a/index.php b/index.php new file mode 100644 index 000000000..f3ed38c8a --- /dev/null +++ b/index.php @@ -0,0 +1,11 @@ +run(); + From 80542174af3699d9cd9f16ad14d116be12f10ddc Mon Sep 17 00:00:00 2001 From: Rodrigo Werlich Date: Tue, 21 Jun 2022 18:42:12 -0300 Subject: [PATCH 07/18] cadastro de investimento --- .gitignore | 3 +- .htaccess | 4 + bootstrap.php | 4 +- index.php | 1 - routes/investimento.php | 8 ++ src/Controllers/ApiController.php | 61 +++++++++++++++ src/Controllers/Controller.php | 47 ++++++++++++ src/Helpers/Utils.php | 33 ++++++++ src/Helpers/Validator.php | 28 +++++++ src/Models/Entities/Investment.php | 75 +++++++++++++++++++ .../Repository/InvestmentRepository.php | 35 +++++++++ 11 files changed, 295 insertions(+), 4 deletions(-) create mode 100644 routes/investimento.php create mode 100644 src/Controllers/ApiController.php create mode 100644 src/Controllers/Controller.php create mode 100644 src/Helpers/Utils.php create mode 100644 src/Helpers/Validator.php create mode 100644 src/Models/Entities/Investment.php create mode 100644 src/Models/Repository/InvestmentRepository.php diff --git a/.gitignore b/.gitignore index 331c58f73..ee8d59abe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea -vendor \ No newline at end of file +vendor +configs.ini \ No newline at end of file diff --git a/.htaccess b/.htaccess index e69de29bb..11b28decb 100644 --- a/.htaccess +++ b/.htaccess @@ -0,0 +1,4 @@ +RewriteEngine On +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^ index.php [QSA,L] \ No newline at end of file diff --git a/bootstrap.php b/bootstrap.php index 44c599e13..b6137ad2e 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -74,12 +74,12 @@ /** * Carrega os Controllers pra dentro do Slim */ -foreach (glob('src/Controllers/*.php') as $filename) { +foreach (glob('src/Controllers/*') as $filename) { $filename = explode('/', $filename); $controller = str_replace('.php', '', end($filename)); $container[$controller] = function () use ($controller, $container) { $class = '\\App\\Controllers\\' . $controller; - return new $class($container['em'], $container['renderer']); + return new $class($container['em']); }; } $app = new \Slim\App($container); diff --git a/index.php b/index.php index f3ed38c8a..b1aaa3cff 100644 --- a/index.php +++ b/index.php @@ -1,7 +1,6 @@ group('/investimento', function () use ($app) { + $app->post('/', fn(Request $request, Response $response) => $this->ApiController->save($request, $response)); +}); \ No newline at end of file diff --git a/src/Controllers/ApiController.php b/src/Controllers/ApiController.php new file mode 100644 index 000000000..bffd5b9c9 --- /dev/null +++ b/src/Controllers/ApiController.php @@ -0,0 +1,61 @@ +em->beginTransaction(); + $data = (array)$request->getParsedBody(); + $fields = [ + 'created' => 'Data de criação', + 'owner' => 'Proprietário', + 'initialValue' => 'Valor', + ]; + Validator::requireValidator($fields, $data); + Validator::validDate($data['created']); + $created = \DateTime::createFromFormat('d/m/Y', $data['created']); + if ($created->format('Y-m-d') > date('Y-m-d')) throw new \Exception('A data não pode ser maior que o dia atual'); + if ((float)$data['initialValue'] < 0) throw new \Exception('Valor minimo do investimento é zero'); + $investment = new Investment(); + $investment->setCreated($created) + ->setInitialValue((float)$data['initialValue']) + ->setOwner($data['owner']); + $investment = $this->em->getRepository(Investment::class)->save($investment); + $this->em->commit(); + return $response->withJson([ + 'status' => 'ok', + 'id' => $investment->getId(), + ], 201) + ->withHeader('Content-type', 'application/json'); + } catch (Exception $e) { + $this->em->rollback(); + return $response->withJson([ + 'status' => 'error', + 'message' => $e->getMessage(), + ])->withStatus(500); + } + } + + +} diff --git a/src/Controllers/Controller.php b/src/Controllers/Controller.php new file mode 100644 index 000000000..2108bc33b --- /dev/null +++ b/src/Controllers/Controller.php @@ -0,0 +1,47 @@ +em = $entityManager; + } + + protected function getConfigs() + { + $config = parse_ini_file('configs.ini', true); + return $config[$config['environment']]; + } + +} diff --git a/src/Helpers/Utils.php b/src/Helpers/Utils.php new file mode 100644 index 000000000..5f47c088e --- /dev/null +++ b/src/Helpers/Utils.php @@ -0,0 +1,33 @@ + $value) { + if (!array_key_exists($key, $data) || (is_string($data[$key]) && trim($data[$key]) === '') || $data[$key] === null) { + throw new \Exception('O campo ' . $value . ' é obrigátorio'); + } + } + } + + +} diff --git a/src/Models/Entities/Investment.php b/src/Models/Entities/Investment.php new file mode 100644 index 000000000..966133389 --- /dev/null +++ b/src/Models/Entities/Investment.php @@ -0,0 +1,75 @@ +created = new \DateTime(); + } + + public function getId(): int + { + return $this->id; + } + + public function getCreated(): \DateTime + { + return $this->created; + } + + public function setCreated(\DateTime $created): Investment + { + $this->created = $created; + return $this; + } + + public function getOwner(): string + { + return $this->owner; + } + + public function setOwner(string $owner): Investment + { + $this->owner = $owner; + return $this; + } + + public function getInitialValue(): float + { + return $this->initialValue; + } + + public function setInitialValue(float $initialValue) + { + $this->initialValue = $initialValue; + return $this; + } + +} \ No newline at end of file diff --git a/src/Models/Repository/InvestmentRepository.php b/src/Models/Repository/InvestmentRepository.php new file mode 100644 index 000000000..fb8f44658 --- /dev/null +++ b/src/Models/Repository/InvestmentRepository.php @@ -0,0 +1,35 @@ +getEntityManager()->persist($entity); + $this->getEntityManager()->flush(); + return $entity; + } + + public function getByCompany(Company $company, ?int $id = null) + { + $where = ''; + $params[':company'] = $company->getId(); + if ((int)$id > 0) { + $params[':id'] = $id; + $where = ' AND u.id = :id'; + } + $query = $this->getEntityManager()->createQuery( + "SELECT u FROM App\Models\Entities\Client as u + JOIN u.company as c + WHERE c.id = :company {$where} + ORDER BY u.name ASC"); + $query->execute($params); + return $query->getResult(); + } + + +} \ No newline at end of file From 60c32c89edf450524626d936e0de070c7690a9ae Mon Sep 17 00:00:00 2001 From: Rodrigo Werlich Date: Wed, 22 Jun 2022 01:43:44 -0300 Subject: [PATCH 08/18] sacar e exibir investimento --- routes/investimento.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/routes/investimento.php b/routes/investimento.php index 98ab406a6..8e8aef582 100644 --- a/routes/investimento.php +++ b/routes/investimento.php @@ -5,4 +5,7 @@ $app->group('/investimento', function () use ($app) { $app->post('/', fn(Request $request, Response $response) => $this->ApiController->save($request, $response)); + $app->get('/{owner}/{index}/', fn(Request $request, Response $response) => $this->ApiController->viewInvestiment($request, $response)); + $app->get('/{id}/', fn(Request $request, Response $response) => $this->ApiController->viewInvestiment($request, $response)); + $app->put('/{id}/', fn(Request $request, Response $response) => $this->ApiController->withdraw($request, $response)); }); \ No newline at end of file From 1e65fe40fe7c7f6779c6467abeee1ca8ac7175e0 Mon Sep 17 00:00:00 2001 From: Rodrigo Werlich Date: Wed, 22 Jun 2022 01:43:52 -0300 Subject: [PATCH 09/18] sacar e exibir investimento --- src/Controllers/ApiController.php | 81 +++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/src/Controllers/ApiController.php b/src/Controllers/ApiController.php index bffd5b9c9..3d7227386 100644 --- a/src/Controllers/ApiController.php +++ b/src/Controllers/ApiController.php @@ -22,6 +22,28 @@ class ApiController extends Controller { + private function calculateProfitValue(Investment $investment): float + { + $expectedValue = $investment->getInitialValue(); + $end = $investment->getWithdrawalDate() ?? new \DateTime(); + $dateInterval = $investment->getCreated()->diff($end); + $months = $dateInterval->m + ($dateInterval->y * 12); + for ($i = 0; $i < $months; $i++) { + $expectedValue += $expectedValue * 0.52 / 100; + } + return $expectedValue - $investment->getInitialValue(); + } + + private function calculateTaxValue(Investment $investment): float + { + $profit = $this->calculateProfitValue($investment); + $end = $investment->getWithdrawalDate(); + $dateInterval = $investment->getCreated()->diff($end); + if ($dateInterval->y < 1) return $profit * 22.5 / 100; + elseif ($dateInterval->y < 2) return $profit * 18.5 / 100; + else return $profit * 15 / 100; + } + public function save(Request $request, Response $response) { try { @@ -57,5 +79,64 @@ public function save(Request $request, Response $response) } } + public function viewInvestiment(Request $request, Response $response) + { + try { + $id = $request->getAttribute('route')->getArgument('id'); + $investment = $this->em->getRepository(Investment::class)->find($id); + return $response->withJson([ + 'status' => 'ok', + 'initialValue' => Utils::formatMoney($investment->getInitialValue()), + 'profitValue' => Utils::formatMoney($this->calculateProfitValue($investment)), + 'expectedValue' => Utils::formatMoney($investment->getInitialValue() + $this->calculateProfitValue($investment)), + ], 200) + ->withHeader('Content-type', 'application/json'); + } catch (Exception $e) { + $this->em->rollback(); + return $response->withJson([ + 'status' => 'error', + 'message' => $e->getMessage(), + ])->withStatus(500); + } + } + + public function withdraw(Request $request, Response $response) + { + try { + $this->em->beginTransaction(); + $data = (array)$request->getParsedBody(); + $fields = [ + 'withdrawDate' => 'Data de saque', + ]; + Validator::requireValidator($fields, $data); + Validator::validDate($data['withdrawDate']); + $withdrawDate = \DateTime::createFromFormat('d/m/Y', $data['withdrawDate']); + $id = $request->getAttribute('route')->getArgument('id'); + $investment = $this->em->getRepository(Investment::class)->find($id); + if ($investment->getWithdrawalDate() != null) throw new \Exception('Esse investimento já foi sacado'); + if ($withdrawDate->format('Y-m-d') > date('Y-m-d')) throw new \Exception('A data não pode ser maior que o dia atual'); + if ($withdrawDate->format('Y-m-d') < $investment->getCreated()->format('Y-m-d')) throw new \Exception("Data minima {$investment->getCreated()->format('d/m/Y')}"); + $investment->setWithdrawalDate($withdrawDate) + ->setTax($this->calculateTaxValue($investment)) + ->setProfit($this->calculateProfitValue($investment)); + $this->em->getRepository(Investment::class)->save($investment); + $this->em->commit(); + return $response->withJson([ + 'status' => 'ok', + 'initialValue' => Utils::formatMoney($investment->getInitialValue()), + 'profitValue' => Utils::formatMoney($investment->getProfit()), + 'taxValue' => Utils::formatMoney($investment->getTax()), + 'withdrawValue' => Utils::formatMoney($investment->getWithdrawValue()), + ], 200) + ->withHeader('Content-type', 'application/json'); + } catch (Exception $e) { + $this->em->rollback(); + return $response->withJson([ + 'status' => 'error', + 'message' => $e->getMessage(), + ])->withStatus(500); + } + } + } From ea5bd1296a8a7ce6dad6127210ca7b18a8f7f8ae Mon Sep 17 00:00:00 2001 From: Rodrigo Werlich Date: Wed, 22 Jun 2022 01:44:02 -0300 Subject: [PATCH 10/18] lucro e taxa --- src/Models/Entities/Investment.php | 57 +++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/src/Models/Entities/Investment.php b/src/Models/Entities/Investment.php index 966133389..b1376fcea 100644 --- a/src/Models/Entities/Investment.php +++ b/src/Models/Entities/Investment.php @@ -8,16 +8,22 @@ */ class Investment { + /** * @Id @GeneratedValue @Column(type="integer") */ private ?int $id = null; /** - * @Column(type="datetime") + * @Column(type="date") */ private \DateTime $created; + /** + * @Column(type="date", nullable=true) + */ + private ?\DateTime $withdrawalDate = null; + /** * @Column(type="string") */ @@ -28,6 +34,16 @@ class Investment */ private float $initialValue = 0; + /** + * @Column(type="float", nullable=true) + */ + private ?float $tax = null; + + /** + * @Column(type="float", nullable=true) + */ + private ?float $profit = null; + public function __construct() { @@ -72,4 +88,43 @@ public function setInitialValue(float $initialValue) return $this; } + public function getWithdrawalDate(): ?\DateTime + { + return $this->withdrawalDate; + } + + public function setWithdrawalDate(?\DateTime $withdrawalDate): Investment + { + $this->withdrawalDate = $withdrawalDate; + return $this; + } + + public function getTax(): ?float + { + return $this->tax; + } + + public function setTax(?float $tax): Investment + { + $this->tax = $tax; + return $this; + } + + public function getProfit(): ?float + { + return $this->profit; + } + + public function setProfit(?float $profit): Investment + { + $this->profit = $profit; + return $this; + } + + public function getWithdrawValue(): float + { + return $this->initialValue + $this->profit - $this->tax; + } + + } \ No newline at end of file From 196600b38ef0d3d2d82bd7e32ce247a7242cc543 Mon Sep 17 00:00:00 2001 From: Rodrigo Werlich Date: Thu, 23 Jun 2022 19:41:33 -0300 Subject: [PATCH 11/18] dependencias --- API.md | 0 README.md | 92 ++----------------- routes/cliente.php | 1 + src/Controllers/ClientController.php | 8 ++ ...ntroller.php => InvestimentController.php} | 4 +- src/Models/Entities/Client.php | 8 ++ src/Models/Repository/ClientRepository.php | 8 ++ 7 files changed, 34 insertions(+), 87 deletions(-) create mode 100644 API.md create mode 100644 routes/cliente.php create mode 100644 src/Controllers/ClientController.php rename src/Controllers/{ApiController.php => InvestimentController.php} (98%) create mode 100644 src/Models/Entities/Client.php create mode 100644 src/Models/Repository/ClientRepository.php diff --git a/API.md b/API.md new file mode 100644 index 000000000..e69de29bb diff --git a/README.md b/README.md index c74ac566e..09ef6393d 100644 --- a/README.md +++ b/README.md @@ -1,88 +1,10 @@ -# Back End Test Project +# Back End Test Project -You should see this challenge as an opportunity to create an application following modern development best practices (given the stack of your choice), but also feel free to use your own architecture preferences (coding standards, code organization, third-party libraries, etc). It’s perfectly fine to use vanilla code or any framework or libraries. +Desafio para o teste de back end da **Coderockr**. -## Scope +**Requisitos:** -In this challenge you should build an API for an application that stores and manages investments, it should have the following features: - -1. __Creation__ of an investment with an owner, a creation date and an amount. - 1. The creation date of an investment can be today or a date in the past. - 2. An investment should not be or become negative. -2. __View__ of an investment with its initial amount and expected balance. - 1. Expected balance should be the sum of the invested amount and the [gains][]. -3. __Withdrawal__ of a investment. - 1. The withdraw will always be the sum of the initial amount and its gains, - partial withdrawn is not supported. - 2. Withdrawals can happen in the past or today, but can't happen before the investment creation or the future. - 3. [Taxes][taxes] need to be applied to the withdrawals before showing the - final value. -4. __List__ of a person's investments - 1. This list should have pagination. - -__NOTE:__ the implementation of an interface will not be evaluated. - -### Gain Calculation - -The investment will pay 0.52% every month in the same day of the investment creation. - -Given that the gain is paid every month, it should be treated as [compound gain][], which means that every new period (month) the amount gained will become part of the investment balance for the next payment. - -### Taxation - -When money is withdrawn, tax is triggered. Taxes apply only to the profit/gain portion of the money withdrawn. For example, if the initial investment was 1000.00, the current balance is 1200.00, then the taxes will be applied to the 200.00. - -The tax percentage changes according to the age of the investment: -* If it is less than one year old, the percentage will be 22.5% (tax = 45.00). -* If it is between one and two years old, the percentage will be 18.5% (tax = 37.00). -* If older than two years, the percentage will be 15% (tax = 30.00). - -## Requirements -1. Create project using any technology of your preference. It’s perfectly OK to use vanilla code or any framework or libraries; -2. Although you can use as many dependencies as you want, you should manage them wisely; -3. It is not necessary to send the notification emails, however, the code required for that would be welcome; -4. The API must be documented in some way. - -## Deliverables -The project source code and dependencies should be made available in GitHub. Here are the steps you should follow: -1. Fork this repository to your GitHub account (create an account if you don't have one, you will need it working with us). -2. Create a "development" branch and commit the code to it. Do not push the code to the main branch. -3. Include a README file that describes: - - Special build instructions, if any - - List of third-party libraries used and short description of why/how they were used - - A link to the API documentation. -4. Once the work is complete, create a pull request from "development" into "main" and send us the link. -5. Avoid using huge commits hiding your progress. Feel free to work on a branch and use `git rebase` to adjust your commits before submitting the final version. - -## Coding Standards -When working on the project be as clean and consistent as possible. - -## Project Deadline -Ideally you'd finish the test project in 5 days. It shouldn't take you longer than a entire week. - -## Quality Assurance -Use the following checklist to ensure high quality of the project. - -### General -- First of all, the application should run without errors. -- Are all requirements set above met? -- Is coding style consistent? -- The API is well documented? -- The API has unit tests? - -## Submission -1. A link to the Github repository. -2. Briefly describe how you decided on the tools that you used. - -## Have Fun Coding 🤘 -- This challenge description is intentionally vague in some aspects, but if you need assistance feel free to ask for help. -- If any of the seems out of your current level, you may skip it, but remember to tell us about it in the pull request. - -## Credits - -This coding challenge was inspired on [kinvoapp/kinvo-back-end-test](https://github.com/kinvoapp/kinvo-back-end-test/blob/2f17d713de739e309d17a1a74a82c3fd0e66d128/README.md) - -[gains]: #gain-calculation -[taxes]: #taxation -[interest]: #interest-calculation -[compound gain]: https://www.investopedia.com/terms/g/gain.asp +* [PHP 8.1](https://www.php.net/releases/8.1/en.php) +* [Composer 2](https://getcomposer.org/download/) +* [Doctrine 2.11](https://www.doctrine-project.org/projects/doctrine-orm/en/2.11/index.html) +* [Slim 3.12](http://www.slimframework.com/docs/v3/) \ No newline at end of file diff --git a/routes/cliente.php b/routes/cliente.php new file mode 100644 index 000000000..b3d9bbc7f --- /dev/null +++ b/routes/cliente.php @@ -0,0 +1 @@ +em->beginTransaction(); diff --git a/src/Models/Entities/Client.php b/src/Models/Entities/Client.php new file mode 100644 index 000000000..92c4710e3 --- /dev/null +++ b/src/Models/Entities/Client.php @@ -0,0 +1,8 @@ + Date: Thu, 23 Jun 2022 19:41:59 -0300 Subject: [PATCH 12/18] criado endpoint e relacionamento entre cliente e investimento --- routes/cliente.php | 7 +++++ routes/investimento.php | 8 ++--- src/Controllers/ClientController.php | 34 +++++++++++++++++++++- src/Models/Entities/Client.php | 32 +++++++++++++++++++- src/Models/Entities/Investment.php | 13 +++++---- src/Models/Repository/ClientRepository.php | 12 +++++++- 6 files changed, 93 insertions(+), 13 deletions(-) diff --git a/routes/cliente.php b/routes/cliente.php index b3d9bbc7f..e03576aef 100644 --- a/routes/cliente.php +++ b/routes/cliente.php @@ -1 +1,8 @@ group('/cliente', function () use ($app) { + $app->post('/', fn(Request $request, Response $response) => $this->ClientController->create($request, $response)); +}); \ No newline at end of file diff --git a/routes/investimento.php b/routes/investimento.php index 8e8aef582..da0f1fda4 100644 --- a/routes/investimento.php +++ b/routes/investimento.php @@ -4,8 +4,8 @@ use \Psr\Http\Message\ServerRequestInterface as Request; $app->group('/investimento', function () use ($app) { - $app->post('/', fn(Request $request, Response $response) => $this->ApiController->save($request, $response)); - $app->get('/{owner}/{index}/', fn(Request $request, Response $response) => $this->ApiController->viewInvestiment($request, $response)); - $app->get('/{id}/', fn(Request $request, Response $response) => $this->ApiController->viewInvestiment($request, $response)); - $app->put('/{id}/', fn(Request $request, Response $response) => $this->ApiController->withdraw($request, $response)); + $app->post('/', fn(Request $request, Response $response) => $this->InvestimentController->createInvestiment($request, $response)); + $app->get('/{owner}/{index}/', fn(Request $request, Response $response) => $this->InvestimentController->viewInvestiment($request, $response)); + $app->get('/{id}/', fn(Request $request, Response $response) => $this->InvestimentController->viewInvestiment($request, $response)); + $app->put('/{id}/', fn(Request $request, Response $response) => $this->InvestimentController->withdraw($request, $response)); }); \ No newline at end of file diff --git a/src/Controllers/ClientController.php b/src/Controllers/ClientController.php index 32fee7144..bba804894 100644 --- a/src/Controllers/ClientController.php +++ b/src/Controllers/ClientController.php @@ -2,7 +2,39 @@ namespace App\Controllers; -class ClientController +use App\Helpers\Validator; +use App\Models\Entities\Client; +use Psr\Http\Message\ResponseInterface as Response; +use Psr\Http\Message\ServerRequestInterface as Request; + +class ClientController extends Controller { + public function create(Request $request, Response $response) + { + try { + $this->em->beginTransaction(); + $data = (array)$request->getParsedBody(); + $fields = [ + 'name' => 'Nome', + ]; + Validator::requireValidator($fields, $data); + $client = new Client(); + $client->setName($data['name']); + $client = $this->em->getRepository(Client::class)->save($client); + $this->em->commit(); + return $response->withJson([ + 'status' => 'ok', + 'id' => $client->getId(), + ], 201) + ->withHeader('Content-type', 'application/json'); + } catch (Exception $e) { + $this->em->rollback(); + return $response->withJson([ + 'status' => 'error', + 'message' => $e->getMessage(), + ])->withStatus(500); + } + } + } \ No newline at end of file diff --git a/src/Models/Entities/Client.php b/src/Models/Entities/Client.php index 92c4710e3..5cf20ebbe 100644 --- a/src/Models/Entities/Client.php +++ b/src/Models/Entities/Client.php @@ -2,7 +2,37 @@ namespace App\Models\Entities; +/** + * @Entity @Table(name="clients") + * @ORM @Entity(repositoryClass="App\Models\Repository\ClientRepository") + */ class Client { + /** + * @Id @GeneratedValue @Column(type="integer") + */ + private ?int $id = null; -} \ No newline at end of file + /** + * @Column(type="string") + */ + private string $name = ''; + + + public function getId(): ?int + { + return $this->id; + } + + public function getName(): string + { + return $this->name; + } + + public function setName(string $name): Client + { + $this->name = $name; + return $this; + } + +} diff --git a/src/Models/Entities/Investment.php b/src/Models/Entities/Investment.php index b1376fcea..419a6deb6 100644 --- a/src/Models/Entities/Investment.php +++ b/src/Models/Entities/Investment.php @@ -25,9 +25,10 @@ class Investment private ?\DateTime $withdrawalDate = null; /** - * @Column(type="string") + * @ManyToOne(targetEntity="Client") + * @JoinColumn(name="client", referencedColumnName="id") */ - private string $owner = ''; + private Client $client; /** * @Column(type="float") @@ -66,14 +67,14 @@ public function setCreated(\DateTime $created): Investment return $this; } - public function getOwner(): string + public function getClient(): Client { - return $this->owner; + return $this->client; } - public function setOwner(string $owner): Investment + public function setClient(Client $client): Investment { - $this->owner = $owner; + $this->client = $client; return $this; } diff --git a/src/Models/Repository/ClientRepository.php b/src/Models/Repository/ClientRepository.php index 2c28b0a10..805655a8e 100644 --- a/src/Models/Repository/ClientRepository.php +++ b/src/Models/Repository/ClientRepository.php @@ -2,7 +2,17 @@ namespace App\Models\Repository; -class ClientRepository +use App\Models\Entities\Client; +use Doctrine\ORM\EntityRepository; + +class ClientRepository extends EntityRepository { + public function save(Client $entity): Client + { + $this->getEntityManager()->persist($entity); + $this->getEntityManager()->flush(); + return $entity; + } + } \ No newline at end of file From 34221ca5e156a04b7f8b238439fb0892a4c5554d Mon Sep 17 00:00:00 2001 From: Rodrigo Werlich Date: Thu, 23 Jun 2022 19:47:17 -0300 Subject: [PATCH 13/18] validacao de cliente e se ja foi calculado o lucro --- src/Controllers/InvestimentController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Controllers/InvestimentController.php b/src/Controllers/InvestimentController.php index 056ced9f3..32a7fa723 100644 --- a/src/Controllers/InvestimentController.php +++ b/src/Controllers/InvestimentController.php @@ -5,6 +5,7 @@ use App\Helpers\Utils; use App\Helpers\Validator; use App\Models\Entities\City; +use App\Models\Entities\Client; use App\Models\Entities\Country; use App\Models\Entities\Investment; use App\Models\Entities\Member; @@ -36,7 +37,7 @@ private function calculateProfitValue(Investment $investment): float private function calculateTaxValue(Investment $investment): float { - $profit = $this->calculateProfitValue($investment); + $profit = $investment->getProfit() ?? $this->calculateProfitValue($investment); $end = $investment->getWithdrawalDate(); $dateInterval = $investment->getCreated()->diff($end); if ($dateInterval->y < 1) return $profit * 22.5 / 100; @@ -59,10 +60,12 @@ public function createInvestiment(Request $request, Response $response) $created = \DateTime::createFromFormat('d/m/Y', $data['created']); if ($created->format('Y-m-d') > date('Y-m-d')) throw new \Exception('A data não pode ser maior que o dia atual'); if ((float)$data['initialValue'] < 0) throw new \Exception('Valor minimo do investimento é zero'); + $owner = $this->em->getRepository(Client::class)->find($data['owner']); + if (!$owner) throw new \Exception('Cliente inválido'); $investment = new Investment(); $investment->setCreated($created) ->setInitialValue((float)$data['initialValue']) - ->setOwner($data['owner']); + ->setClient($owner); $investment = $this->em->getRepository(Investment::class)->save($investment); $this->em->commit(); return $response->withJson([ From 132fc72dde9b90b798ebf85d23e7349c577f4b24 Mon Sep 17 00:00:00 2001 From: Rodrigo Werlich Date: Thu, 23 Jun 2022 19:54:50 -0300 Subject: [PATCH 14/18] adicionado status 400 bad request --- src/Controllers/ClientController.php | 2 +- src/Controllers/InvestimentController.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Controllers/ClientController.php b/src/Controllers/ClientController.php index bba804894..65f3ca9ea 100644 --- a/src/Controllers/ClientController.php +++ b/src/Controllers/ClientController.php @@ -33,7 +33,7 @@ public function create(Request $request, Response $response) return $response->withJson([ 'status' => 'error', 'message' => $e->getMessage(), - ])->withStatus(500); + ])->withStatus(400); } } diff --git a/src/Controllers/InvestimentController.php b/src/Controllers/InvestimentController.php index 32a7fa723..f07f875a5 100644 --- a/src/Controllers/InvestimentController.php +++ b/src/Controllers/InvestimentController.php @@ -78,7 +78,7 @@ public function createInvestiment(Request $request, Response $response) return $response->withJson([ 'status' => 'error', 'message' => $e->getMessage(), - ])->withStatus(500); + ])->withStatus(400); } } @@ -87,6 +87,7 @@ public function viewInvestiment(Request $request, Response $response) try { $id = $request->getAttribute('route')->getArgument('id'); $investment = $this->em->getRepository(Investment::class)->find($id); + if (!$investment) throw new \Exception('Cliente inválido'); return $response->withJson([ 'status' => 'ok', 'initialValue' => Utils::formatMoney($investment->getInitialValue()), @@ -99,7 +100,7 @@ public function viewInvestiment(Request $request, Response $response) return $response->withJson([ 'status' => 'error', 'message' => $e->getMessage(), - ])->withStatus(500); + ])->withStatus(400); } } @@ -137,7 +138,7 @@ public function withdraw(Request $request, Response $response) return $response->withJson([ 'status' => 'error', 'message' => $e->getMessage(), - ])->withStatus(500); + ])->withStatus(400); } } From fd20e2035d2cb17aee40b297b4f8091f416afd48 Mon Sep 17 00:00:00 2001 From: Rodrigo Werlich Date: Thu, 23 Jun 2022 20:58:50 -0300 Subject: [PATCH 15/18] listagem de investimentos por cliente --- routes/investimento.php | 2 +- src/Controllers/InvestimentController.php | 37 ++++++++++++++++++- .../Repository/InvestmentRepository.php | 25 ++++++------- 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/routes/investimento.php b/routes/investimento.php index da0f1fda4..a29ba04ce 100644 --- a/routes/investimento.php +++ b/routes/investimento.php @@ -5,7 +5,7 @@ $app->group('/investimento', function () use ($app) { $app->post('/', fn(Request $request, Response $response) => $this->InvestimentController->createInvestiment($request, $response)); - $app->get('/{owner}/{index}/', fn(Request $request, Response $response) => $this->InvestimentController->viewInvestiment($request, $response)); + $app->get('/{owner}/{page}/', fn(Request $request, Response $response) => $this->InvestimentController->investimentByClient($request, $response)); $app->get('/{id}/', fn(Request $request, Response $response) => $this->InvestimentController->viewInvestiment($request, $response)); $app->put('/{id}/', fn(Request $request, Response $response) => $this->InvestimentController->withdraw($request, $response)); }); \ No newline at end of file diff --git a/src/Controllers/InvestimentController.php b/src/Controllers/InvestimentController.php index f07f875a5..9f20c2511 100644 --- a/src/Controllers/InvestimentController.php +++ b/src/Controllers/InvestimentController.php @@ -38,7 +38,7 @@ private function calculateProfitValue(Investment $investment): float private function calculateTaxValue(Investment $investment): float { $profit = $investment->getProfit() ?? $this->calculateProfitValue($investment); - $end = $investment->getWithdrawalDate(); + $end = $investment->getWithdrawalDate() ?? new \DateTime(); $dateInterval = $investment->getCreated()->diff($end); if ($dateInterval->y < 1) return $profit * 22.5 / 100; elseif ($dateInterval->y < 2) return $profit * 18.5 / 100; @@ -91,7 +91,7 @@ public function viewInvestiment(Request $request, Response $response) return $response->withJson([ 'status' => 'ok', 'initialValue' => Utils::formatMoney($investment->getInitialValue()), - 'profitValue' => Utils::formatMoney($this->calculateProfitValue($investment)), + 'profitValue' => Utils::formatMoney($investment->getProfit() ?? $this->calculateProfitValue($investment)), 'expectedValue' => Utils::formatMoney($investment->getInitialValue() + $this->calculateProfitValue($investment)), ], 200) ->withHeader('Content-type', 'application/json'); @@ -142,5 +142,38 @@ public function withdraw(Request $request, Response $response) } } + public function investimentByClient(Request $request, Response $response) + { + try { + $owner = $request->getAttribute('route')->getArgument('owner'); + $client = $this->em->getRepository(Client::class)->find($owner); + if (!$client) throw new \Exception('Cliente inválido'); + $page = $request->getAttribute('route')->getArgument('page'); + $investments = $this->em->getRepository(Investment::class)->getByClient($client, $page); + $investmentsArray = []; + foreach ($investments as $investment) { + $investmentsArray[] = [ + 'id' => $investment->getId(), + 'created' => $investment->getCreated()->format('d/m/Y'), + 'withdrawalDate' => $investment->getWithdrawalDate() ? $investment->getWithdrawalDate()->format('d/m/Y') : '', + 'initialValue' => $investment->getInitialValue(), + 'profitValue' => $investment->getProfit() ?? $this->calculateProfitValue($investment), + 'taxValue' => $investment->getTax() ?? '', + ]; + } + return $response->withJson([ + 'status' => 'ok', + 'investments' => $investmentsArray + ], 200) + ->withHeader('Content-type', 'application/json'); + } catch (Exception $e) { + $this->em->rollback(); + return $response->withJson([ + 'status' => 'error', + 'message' => $e->getMessage(), + ])->withStatus(400); + } + } + } diff --git a/src/Models/Repository/InvestmentRepository.php b/src/Models/Repository/InvestmentRepository.php index fb8f44658..53218e974 100644 --- a/src/Models/Repository/InvestmentRepository.php +++ b/src/Models/Repository/InvestmentRepository.php @@ -2,6 +2,7 @@ namespace App\Models\Repository; +use App\Models\Entities\Client; use App\Models\Entities\Investment; use Doctrine\ORM\EntityRepository; @@ -14,21 +15,17 @@ public function save(Investment $entity): Investment return $entity; } - public function getByCompany(Company $company, ?int $id = null) + public function getByClient(Client $client, int $offset, int $limit = 2) { - $where = ''; - $params[':company'] = $company->getId(); - if ((int)$id > 0) { - $params[':id'] = $id; - $where = ' AND u.id = :id'; - } - $query = $this->getEntityManager()->createQuery( - "SELECT u FROM App\Models\Entities\Client as u - JOIN u.company as c - WHERE c.id = :company {$where} - ORDER BY u.name ASC"); - $query->execute($params); - return $query->getResult(); + $params[':client'] = $client->getId(); + return $this->getEntityManager()->createQuery( + "SELECT i FROM App\Models\Entities\Investment AS i + JOIN i.client AS c + WHERE c.id = :client + ORDER BY i.id ASC") + ->setMaxResults($limit) + ->setFirstResult($offset * $limit) + ->execute($params); } From 2572e7e8796a460f09d1ec694ae7d08c2666a2d5 Mon Sep 17 00:00:00 2001 From: Rodrigo Werlich Date: Thu, 23 Jun 2022 21:37:09 -0300 Subject: [PATCH 16/18] removido documentacao md --- API.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 API.md diff --git a/API.md b/API.md deleted file mode 100644 index e69de29bb..000000000 From 187b4131e8b54e83513300934b6ed42c68eb6f6d Mon Sep 17 00:00:00 2001 From: Rodrigo Werlich Date: Thu, 23 Jun 2022 21:38:26 -0300 Subject: [PATCH 17/18] adicionado link para documentacao da API --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 09ef6393d..2700ecbec 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ Desafio para o teste de back end da **Coderockr**. +**[Documentação API](https://backendtestcoderockr.docs.apiary.io/)** + + **Requisitos:** * [PHP 8.1](https://www.php.net/releases/8.1/en.php) From 7d6051ffa5d211c9ae51565a2dc39d380dd10fc8 Mon Sep 17 00:00:00 2001 From: Rodrigo Werlich Date: Thu, 23 Jun 2022 22:52:00 -0300 Subject: [PATCH 18/18] ajuste no retorno da visualizacao do investimento --- src/Controllers/InvestimentController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Controllers/InvestimentController.php b/src/Controllers/InvestimentController.php index 9f20c2511..0f4e55692 100644 --- a/src/Controllers/InvestimentController.php +++ b/src/Controllers/InvestimentController.php @@ -92,7 +92,11 @@ public function viewInvestiment(Request $request, Response $response) 'status' => 'ok', 'initialValue' => Utils::formatMoney($investment->getInitialValue()), 'profitValue' => Utils::formatMoney($investment->getProfit() ?? $this->calculateProfitValue($investment)), - 'expectedValue' => Utils::formatMoney($investment->getInitialValue() + $this->calculateProfitValue($investment)), + 'taxValue' => Utils::formatMoney($investment->getTax() ?? 0), + 'expectedValue' => Utils::formatMoney($investment->getInitialValue() + + ($investment->getProfit() ?? $this->calculateProfitValue($investment)) + - ($investment->getTax() ?? 0) + ), ], 200) ->withHeader('Content-type', 'application/json'); } catch (Exception $e) {