diff --git a/composer.json b/composer.json index 5088de6..1731132 100644 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "ext-iconv": "*", "ext-json": "*", "api-platform/core": "^2.5", + "giggsey/libphonenumber-for-php": "^8.12", "lexik/jwt-authentication-bundle": "^2.8", "nelmio/cors-bundle": "^2.1", "ramsey/uuid-doctrine": "^1.6", diff --git a/composer.lock b/composer.lock index c8cfc30..61b27ab 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "68a12cd899566277e4d6c26c5246591e", + "content-hash": "ab705d4032176d0b77a1c17c5bd8447a", "packages": [ { "name": "api-platform/core", @@ -199,12 +199,6 @@ "brick", "math" ], - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/brick/math", - "type": "tidelift" - } - ], "time": "2020-08-18T23:57:15+00:00" }, { @@ -260,20 +254,6 @@ } ], "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], "time": "2020-08-25T05:50:16+00:00" }, { @@ -426,20 +406,6 @@ "redis", "xcache" ], - "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": "2020-07-07T18:54:01+00:00" }, { @@ -581,20 +547,6 @@ "doctrine", "php" ], - "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": "2020-06-05T16:59:53+00:00" }, { @@ -690,20 +642,6 @@ "sqlserver", "sqlsrv" ], - "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": "2020-09-02T01:35:42+00:00" }, { @@ -780,20 +718,6 @@ "event system", "events" ], - "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" }, { @@ -872,20 +796,6 @@ "uppercase", "words" ], - "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": "2020-05-29T07:19:59+00:00" }, { @@ -942,20 +852,6 @@ "constructor", "instantiate" ], - "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": "2020-05-29T17:27:14+00:00" }, { @@ -1018,20 +914,6 @@ "parser", "php" ], - "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": "2020-05-25T17:44:05+00:00" }, { @@ -1120,20 +1002,6 @@ "database", "orm" ], - "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/orm", - "type": "tidelift" - } - ], "time": "2020-05-26T16:03:49+00:00" }, { @@ -1218,20 +1086,6 @@ "orm", "persistence" ], - "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": "2020-05-12T19:32:44+00:00" }, { @@ -1369,6 +1223,123 @@ ], "time": "2020-04-27T06:40:36+00:00" }, + { + "name": "giggsey/libphonenumber-for-php", + "version": "8.12.9", + "source": { + "type": "git", + "url": "https://github.com/giggsey/libphonenumber-for-php.git", + "reference": "674b79ae3362409d08e550cb196d982485a76225" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/giggsey/libphonenumber-for-php/zipball/674b79ae3362409d08e550cb196d982485a76225", + "reference": "674b79ae3362409d08e550cb196d982485a76225", + "shasum": "" + }, + "require": { + "giggsey/locale": "^1.7", + "php": ">=5.3.2", + "symfony/polyfill-mbstring": "^1.17" + }, + "require-dev": { + "pear/pear-core-minimal": "^1.9", + "pear/pear_exception": "^1.0", + "pear/versioncontrol_git": "^0.5", + "phing/phing": "^2.7", + "php-coveralls/php-coveralls": "^1.0|^2.0", + "phpunit/phpunit": "^4.8.36|^5.0", + "symfony/console": "^2.8|^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "8.x-dev" + } + }, + "autoload": { + "psr-4": { + "libphonenumber\\": "src/" + }, + "exclude-from-classmap": [ + "/src/data/", + "/src/carrier/data/", + "/src/geocoding/data/", + "/src/timezone/data/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Joshua Gigg", + "email": "giggsey@gmail.com", + "homepage": "https://giggsey.com/" + } + ], + "description": "PHP Port of Google's libphonenumber", + "homepage": "https://github.com/giggsey/libphonenumber-for-php", + "keywords": [ + "geocoding", + "geolocation", + "libphonenumber", + "mobile", + "phonenumber", + "validation" + ], + "time": "2020-08-31T09:51:44+00:00" + }, + { + "name": "giggsey/locale", + "version": "1.9", + "source": { + "type": "git", + "url": "https://github.com/giggsey/Locale.git", + "reference": "b07f1eace8072ccc61445ad8fbd493ff9d783043" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/giggsey/Locale/zipball/b07f1eace8072ccc61445ad8fbd493ff9d783043", + "reference": "b07f1eace8072ccc61445ad8fbd493ff9d783043", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "pear/pear-core-minimal": "^1.9", + "pear/pear_exception": "^1.0", + "pear/versioncontrol_git": "^0.5", + "phing/phing": "~2.7", + "php-coveralls/php-coveralls": "^1.0|^2.0", + "phpunit/phpunit": "^4.8|^5.0", + "symfony/console": "^2.8|^3.0|^4.0", + "symfony/filesystem": "^2.8|^3.0|^4.0", + "symfony/finder": "^2.8|^3.0|^4.0", + "symfony/process": "^2.8|^3.0|^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Giggsey\\Locale\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Joshua Gigg", + "email": "giggsey@gmail.com", + "homepage": "http://giggsey.com/" + } + ], + "description": "Locale functions required by libphonenumber-for-php", + "time": "2020-07-07T11:16:24+00:00" + }, { "name": "lcobucci/jwt", "version": "3.3.3", @@ -1422,16 +1393,6 @@ "JWS", "jwt" ], - "funding": [ - { - "url": "https://github.com/lcobucci", - "type": "github" - }, - { - "url": "https://www.patreon.com/lcobucci", - "type": "patreon" - } - ], "time": "2020-08-20T13:22:28+00:00" }, { @@ -1528,12 +1489,6 @@ "rest", "symfony" ], - "funding": [ - { - "url": "https://github.com/chalasr", - "type": "github" - } - ], "time": "2020-06-14T13:20:35+00:00" }, { @@ -1954,12 +1909,6 @@ "queue", "set" ], - "funding": [ - { - "url": "https://github.com/ramsey", - "type": "github" - } - ], "time": "2020-08-11T00:57:21+00:00" }, { @@ -2041,12 +1990,6 @@ "identifier", "uuid" ], - "funding": [ - { - "url": "https://github.com/ramsey", - "type": "github" - } - ], "time": "2020-08-18T17:17:46+00:00" }, { @@ -2149,20 +2092,6 @@ ], "description": "Symfony AMQP extension Messenger Bridge", "homepage": "https://symfony.com", - "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": "2020-05-20T17:43:50+00:00" }, { @@ -2220,20 +2149,6 @@ ], "description": "Symfony Asset Component", "homepage": "https://symfony.com", - "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": "2020-05-30T20:35:19+00:00" }, { @@ -2314,20 +2229,6 @@ "caching", "psr6" ], - "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": "2020-09-01T05:52:18+00:00" }, { @@ -2390,20 +2291,6 @@ "interoperability", "standards" ], - "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": "2020-07-06T13:23:11+00:00" }, { @@ -2470,20 +2357,6 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "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": "2020-08-17T07:48:54+00:00" }, { @@ -2563,20 +2436,6 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "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": "2020-09-02T07:07:40+00:00" }, { @@ -2652,20 +2511,6 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "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": "2020-09-01T18:07:16+00:00" }, { @@ -2716,20 +2561,6 @@ ], "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", - "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": "2020-06-06T08:49:21+00:00" }, { @@ -2790,20 +2621,6 @@ ], "description": "Symfony Doctrine Messenger Bridge", "homepage": "https://symfony.com", - "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": "2020-08-21T12:10:32+00:00" }, { @@ -2862,20 +2679,6 @@ "env", "environment" ], - "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": "2020-05-28T08:20:44+00:00" }, { @@ -2933,20 +2736,6 @@ ], "description": "Symfony ErrorHandler Component", "homepage": "https://symfony.com", - "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": "2020-08-17T10:01:29+00:00" }, { @@ -3019,20 +2808,6 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "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": "2020-08-13T14:19:42+00:00" }, { @@ -3095,20 +2870,6 @@ "interoperability", "standards" ], - "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": "2020-07-06T13:23:11+00:00" }, { @@ -3161,20 +2922,6 @@ ], "description": "Symfony ExpressionLanguage Component", "homepage": "https://symfony.com", - "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": "2020-05-31T07:33:39+00:00" }, { @@ -3225,20 +2972,6 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "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": "2020-08-21T17:19:47+00:00" }, { @@ -3288,20 +3021,6 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "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": "2020-08-17T10:01:29+00:00" }, { @@ -3351,20 +3070,6 @@ } ], "description": "Composer plugin for Symfony", - "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": "2020-08-31T14:36:07+00:00" }, { @@ -3498,20 +3203,6 @@ ], "description": "Symfony FrameworkBundle", "homepage": "https://symfony.com", - "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": "2020-08-30T09:59:07+00:00" }, { @@ -3563,30 +3254,16 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony HttpFoundation Component", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], + "description": "Symfony HttpFoundation Component", + "homepage": "https://symfony.com", "time": "2020-08-17T07:48:54+00:00" }, { @@ -3686,20 +3363,6 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "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": "2020-09-02T08:15:18+00:00" }, { @@ -3776,20 +3439,6 @@ ], "description": "Symfony Messenger Component", "homepage": "https://symfony.com", - "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": "2020-08-17T12:05:19+00:00" }, { @@ -3854,20 +3503,6 @@ "portable", "shim" ], - "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": "2020-07-14T12:35:20+00:00" }, { @@ -3935,20 +3570,6 @@ "portable", "shim" ], - "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": "2020-07-14T12:35:20+00:00" }, { @@ -4012,20 +3633,6 @@ "portable", "shim" ], - "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": "2020-07-14T12:35:20+00:00" }, { @@ -4088,20 +3695,6 @@ "portable", "shim" ], - "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": "2020-07-14T12:35:20+00:00" }, { @@ -4168,20 +3761,6 @@ "portable", "shim" ], - "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": "2020-07-14T12:35:20+00:00" }, { @@ -4250,20 +3829,6 @@ "property path", "reflection" ], - "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": "2020-08-30T08:29:58+00:00" }, { @@ -4341,20 +3906,6 @@ "type", "validator" ], - "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": "2020-08-18T07:27:13+00:00" }, { @@ -4409,20 +3960,6 @@ ], "description": "Symfony Redis extension Messenger Bridge", "homepage": "https://symfony.com", - "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": "2020-08-17T07:48:54+00:00" }, { @@ -4501,20 +4038,6 @@ "uri", "url" ], - "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": "2020-08-10T08:03:57+00:00" }, { @@ -4600,20 +4123,6 @@ ], "description": "Symfony SecurityBundle", "homepage": "https://symfony.com", - "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": "2020-08-18T11:41:36+00:00" }, { @@ -4689,20 +4198,6 @@ ], "description": "Symfony Security Component - Core Library", "homepage": "https://symfony.com", - "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": "2020-08-18T11:34:54+00:00" }, { @@ -4762,20 +4257,6 @@ ], "description": "Symfony Security Component - CSRF Library", "homepage": "https://symfony.com", - "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": "2020-05-20T17:43:50+00:00" }, { @@ -4831,20 +4312,6 @@ ], "description": "Symfony Security Component - Guard", "homepage": "https://symfony.com", - "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": "2020-05-20T17:43:50+00:00" }, { @@ -4913,20 +4380,6 @@ ], "description": "Symfony Security Component - HTTP Integration", "homepage": "https://symfony.com", - "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": "2020-08-25T15:26:05+00:00" }, { @@ -5010,20 +4463,6 @@ ], "description": "Symfony Serializer Component", "homepage": "https://symfony.com", - "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": "2020-09-01T05:52:18+00:00" }, { @@ -5086,20 +4525,6 @@ "interoperability", "standards" ], - "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": "2020-07-06T13:23:11+00:00" }, { @@ -5171,20 +4596,6 @@ "utf-8", "utf8" ], - "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": "2020-08-17T07:48:54+00:00" }, { @@ -5246,20 +4657,6 @@ "interoperability", "standards" ], - "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": "2020-07-06T13:23:11+00:00" }, { @@ -5362,20 +4759,6 @@ ], "description": "Symfony Twig Bridge", "homepage": "https://symfony.com", - "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": "2020-08-26T14:33:04+00:00" }, { @@ -5451,20 +4834,6 @@ ], "description": "Symfony TwigBundle", "homepage": "https://symfony.com", - "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": "2020-05-20T17:43:50+00:00" }, { @@ -5562,20 +4931,6 @@ ], "description": "Symfony Validator Component", "homepage": "https://symfony.com", - "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": "2020-08-31T09:01:51+00:00" }, { @@ -5652,20 +5007,6 @@ "debug", "dump" ], - "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": "2020-08-17T07:42:30+00:00" }, { @@ -5727,20 +5068,6 @@ "instantiate", "serialize" ], - "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": "2020-06-07T15:42:22+00:00" }, { @@ -5816,20 +5143,6 @@ "psr13", "push" ], - "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": "2020-05-28T08:20:44+00:00" }, { @@ -5900,20 +5213,6 @@ "transition", "workflow" ], - "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": "2020-05-20T17:43:50+00:00" }, { @@ -5977,20 +5276,6 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "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": "2020-08-26T08:30:57+00:00" }, { @@ -6053,16 +5338,6 @@ "keywords": [ "templating" ], - "funding": [ - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/twig/twig", - "type": "tidelift" - } - ], "time": "2020-08-05T15:13:19+00:00" }, { @@ -6258,20 +5533,6 @@ "orm", "persistence" ], - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdoctrine-bundle", - "type": "tidelift" - } - ], "time": "2020-08-25T10:57:15+00:00" }, { @@ -6342,20 +5603,6 @@ "migrations", "schema" ], - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdoctrine-migrations-bundle", - "type": "tidelift" - } - ], "time": "2020-06-15T06:04:38+00:00" }, { @@ -6441,20 +5688,6 @@ "migrations", "php" ], - "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%2Fmigrations", - "type": "tidelift" - } - ], "time": "2020-06-21T08:55:42+00:00" }, { @@ -6766,20 +5999,6 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "funding": [ - { - "url": "https://github.com/ondrejmirtes", - "type": "github" - }, - { - "url": "https://www.patreon.com/phpstan", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", - "type": "tidelift" - } - ], "time": "2020-09-02T13:14:53+00:00" }, { @@ -6880,20 +6099,6 @@ ], "description": "Symfony Doctrine Bridge", "homepage": "https://symfony.com", - "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": "2020-08-21T17:19:47+00:00" }, { @@ -6944,20 +6149,6 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "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": "2020-05-20T17:43:50+00:00" }, { @@ -7023,20 +6214,6 @@ ], "description": "Symfony WebProfilerBundle", "homepage": "https://symfony.com", - "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": "2020-08-10T08:03:57+00:00" }, { @@ -7164,6 +6341,5 @@ "ext-iconv": "*", "ext-json": "*" }, - "platform-dev": [], - "plugin-api-version": "1.1.0" + "platform-dev": [] } diff --git a/config/api_platform/Organization/Organization.yaml b/config/api_platform/Organization/Organization.yaml new file mode 100644 index 0000000..3e1ed65 --- /dev/null +++ b/config/api_platform/Organization/Organization.yaml @@ -0,0 +1,98 @@ +Acme\Domain\Organization\Organization: + properties: + uuid: + identifier: true + collectionOperations: + post: + method: POST + path: '/organizations' + messenger: true + input: Acme\Application\UseCase\Command\Organization\CreateOrganization\CreateOrganizationInput + output: false + validate: false + status: 202 + openapi_context: + summary: Create an organization + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + uuid: + type: string + format: uuid + required: true + description: Uuid Version 4 https://www.uuidgenerator.net/ + name: + type: string + required: true + example: Apple + description: + type: string + required: true + shortDescription: + type: string + required: true + addressLine1: + type: string + required: true + example: One Apple Park Way + addressLine2: + type: string + required: true + city: + type: string + required: true + example: Cupertino + region: + type: string + required: true + example: CA + country: + type: string + required: true + example: USA + zipCode: + type: string + required: true + example: "95014" + responses: + 202: + description: Request has been received and will be treated later + 400: + description: Invalid input + itemOperations: + get: + method: GET +# output: Acme\UI\Http\Rest\Presentation\User\UserView +# normalization_context: +# groups: [ profile ] + update_billing_information: + method: PUT + path: '/organizations/{uuid}/billing_information' + messenger: true + input: Acme\Application\UseCase\Command\Organization\UpdateBillingInformation\UpdateBillingInformationInput + # Disable API Platform data retriever + read: false + # No content in the response + output: false + # By pass response validation to allow null response + validate: false + # Override default documentation + openapi_context: + summary: Update organization's billing information + # API Platform only supports identifier named `id` in path + parameters: + - in: path + name: uuid + type: string + required: true + responses: + 204: + description: User email updated successfully + 400: + description: Invalid input + 409: + description: Conflict diff --git a/config/api_platform/User/User.yaml b/config/api_platform/User/User.yaml index efbe90b..3bb6fef 100644 --- a/config/api_platform/User/User.yaml +++ b/config/api_platform/User/User.yaml @@ -6,14 +6,14 @@ Acme\Domain\User\User: get: method: GET filters: [ 'user.search_filter' ] - output: Acme\UI\Http\Rest\Presentation\User\UserView - normalization_context: - groups: [ profile ] - get_v2: - path: v2/users - method: GET - query: Acme\Application\UseCase\Query\User\GetUsers\GetUsersQuery - filters: [ 'user.search_filter' ] + output: Acme\UI\Http\Rest\Presentation\User\UserView + normalization_context: + groups: [ profile ] + get_v2: + path: v2/users + method: GET + query: Acme\Application\UseCase\Query\User\GetUsers\GetUsersQuery + filters: [ 'user.search_filter' ] output: Acme\UI\Http\Rest\Presentation\User\UserProfileView post: method: POST diff --git a/config/packages/doctrine/dbal/type/string.yaml b/config/packages/doctrine/dbal/type/string.yaml index 1ac15d7..9b7e9c1 100644 --- a/config/packages/doctrine/dbal/type/string.yaml +++ b/config/packages/doctrine/dbal/type/string.yaml @@ -3,6 +3,8 @@ doctrine: types: email: Acme\Infrastructure\Shared\Doctrine\EmailType hashed_password: Acme\Infrastructure\Shared\Doctrine\HashedPasswordType + phone_number: Acme\Infrastructure\Shared\Doctrine\PhoneNumberType mapping_types: email: string hashed_password: string + phone_number: string diff --git a/config/packages/doctrine/orm/mapping/organization.yaml b/config/packages/doctrine/orm/mapping/organization.yaml new file mode 100644 index 0000000..2e2f3b4 --- /dev/null +++ b/config/packages/doctrine/orm/mapping/organization.yaml @@ -0,0 +1,9 @@ +doctrine: + orm: + mappings: + Organization: + is_bundle: false + type: xml + dir: '%kernel.project_dir%/src/Infrastructure/Organization/Doctrine/Orm/Mapping' + prefix: 'Acme\Domain\Organization' + alias: Organization diff --git a/src/Application/UseCase/Command/Organization/CreateOrganization/CreateOrganizationCommand.php b/src/Application/UseCase/Command/Organization/CreateOrganization/CreateOrganizationCommand.php new file mode 100644 index 0000000..8f7aa32 --- /dev/null +++ b/src/Application/UseCase/Command/Organization/CreateOrganization/CreateOrganizationCommand.php @@ -0,0 +1,52 @@ +uuid = Uuid::fromString($uuid); + $this->profile = new OrganizationProfile($name, $description, $shortDescription); + $this->address = new Address($addressLine1, $addressLine2, $city, $region, $country, $zipCode); + } + + public function uuid(): UuidInterface + { + return $this->uuid; + } + + public function profile(): OrganizationProfile + { + return $this->profile; + } + + public function address(): Address + { + return $this->address; + } +} diff --git a/src/Application/UseCase/Command/Organization/CreateOrganization/CreateOrganizationCommandHandler.php b/src/Application/UseCase/Command/Organization/CreateOrganization/CreateOrganizationCommandHandler.php new file mode 100644 index 0000000..a806311 --- /dev/null +++ b/src/Application/UseCase/Command/Organization/CreateOrganization/CreateOrganizationCommandHandler.php @@ -0,0 +1,27 @@ +organizationRepository = $organizationRepository; + } + + public function __invoke(CreateOrganizationCommand $command): void + { + $organization = Organization::create($command->uuid(), $command->profile(), $command->address()); + + $this->organizationRepository->store($organization); + } +} diff --git a/src/Application/UseCase/Command/Organization/CreateOrganization/CreateOrganizationInput.php b/src/Application/UseCase/Command/Organization/CreateOrganization/CreateOrganizationInput.php new file mode 100644 index 0000000..f7e3b6c --- /dev/null +++ b/src/Application/UseCase/Command/Organization/CreateOrganization/CreateOrganizationInput.php @@ -0,0 +1,70 @@ +validator = $validator; + } + + public function transform($object, string $to, array $context = []) + { + if (false === $object instanceof CreateOrganizationInput) { + throw new \InvalidArgumentException(\sprintf('Object is not an instance of %s', + CreateOrganizationInput::class)); + } + + $this->validator->validate($object, $context); + + return new CreateOrganizationCommand( + $object->uuid, + $object->name, + $object->description, + $object->shortDescription, + $object->addressLine1, + $object->addressLine2, + $object->city, + $object->region, + $object->country, + $object->zipCode + ); + } + + public function supportsTransformation($data, string $to, array $context = []): bool + { + return CreateOrganizationInput::class === ($context['input']['class'] ?? null); + } +} diff --git a/src/Application/UseCase/Command/Organization/UpdateBillingInformation/UpdateBillingInformationCommand.php b/src/Application/UseCase/Command/Organization/UpdateBillingInformation/UpdateBillingInformationCommand.php new file mode 100644 index 0000000..7d4ed0f --- /dev/null +++ b/src/Application/UseCase/Command/Organization/UpdateBillingInformation/UpdateBillingInformationCommand.php @@ -0,0 +1,68 @@ +organizationUuid = Uuid::fromString($organizationUuid); + $this->email = Email::fromString($email); + $this->phoneNumber = PhoneNumber::fromString($phoneNumber); + $this->companyName = $companyName; + $this->address = new Address($addressLine1, $addressLine2, $city, $region, $country, $zipCode); + } + + public function organizationUuid(): UuidInterface + { + return $this->organizationUuid; + } + + public function companyName(): string + { + return $this->companyName; + } + + public function email(): Email + { + return $this->email; + } + + public function phoneNumber(): PhoneNumber + { + return $this->phoneNumber; + } + + public function address(): Address + { + return $this->address; + } +} diff --git a/src/Application/UseCase/Command/Organization/UpdateBillingInformation/UpdateBillingInformationCommandHandler.php b/src/Application/UseCase/Command/Organization/UpdateBillingInformation/UpdateBillingInformationCommandHandler.php new file mode 100644 index 0000000..3eb3a1d --- /dev/null +++ b/src/Application/UseCase/Command/Organization/UpdateBillingInformation/UpdateBillingInformationCommandHandler.php @@ -0,0 +1,30 @@ +organizationRepository = $organizationRepository; + } + + public function __invoke(UpdateBillingInformationCommand $command): void + { + $organization = $this->organizationRepository->get($command->organizationUuid()); + + $organization->updateBillingInformation($command->companyName(), $command->email(), $command->phoneNumber(), $command->address()); + + $this->organizationRepository->store($organization); + } +} diff --git a/src/Application/UseCase/Command/Organization/UpdateBillingInformation/UpdateBillingInformationInput.php b/src/Application/UseCase/Command/Organization/UpdateBillingInformation/UpdateBillingInformationInput.php new file mode 100644 index 0000000..8b552ed --- /dev/null +++ b/src/Application/UseCase/Command/Organization/UpdateBillingInformation/UpdateBillingInformationInput.php @@ -0,0 +1,63 @@ +validator = $validator; + } + + public function transform($object, string $to, array $context = []) + { + if (!$object instanceof UpdateBillingInformationInput) { + throw new \InvalidArgumentException(\sprintf('Object is not an instance of %s', UpdateBillingInformationInput::class)); + } + + if (!isset($context['uuid'])) { + throw new \RuntimeException(\sprintf('Missing uuid value in context')); + } + + if (($uuid = $context['uuid']) && !$uuid instanceof UuidInterface) { + throw new \InvalidArgumentException(\sprintf('Given uuid must be an instance of %s', UuidInterface::class)); + } + + $this->validator->validate($object, $context); + + return new UpdateBillingInformationCommand( + $uuid->toString(), + $object->companyName, + $object->addressLine1, + $object->addressLine2, + $object->city, + $object->region, + $object->country, + $object->zipCode, + $object->phoneNumber, + $object->email + ); + } + + public function supportsTransformation($data, string $to, array $context = []): bool + { + return UpdateBillingInformationInput::class === ($context['input']['class'] ?? null); + } +} diff --git a/src/Application/UseCase/Command/User/ChangeEmail/ChangeEmailCommand.php b/src/Application/UseCase/Command/User/ChangeEmail/ChangeEmailCommand.php index 71f0b64..a612c67 100644 --- a/src/Application/UseCase/Command/User/ChangeEmail/ChangeEmailCommand.php +++ b/src/Application/UseCase/Command/User/ChangeEmail/ChangeEmailCommand.php @@ -9,7 +9,7 @@ use Ramsey\Uuid\Uuid; use Ramsey\Uuid\UuidInterface; -class ChangeEmailCommand implements CommandInterface +final class ChangeEmailCommand implements CommandInterface { private UuidInterface $userUuid; diff --git a/src/Application/UseCase/Command/User/ChangeEmail/ChangeEmailCommandHandler.php b/src/Application/UseCase/Command/User/ChangeEmail/ChangeEmailCommandHandler.php index cf6a95c..19e5934 100644 --- a/src/Application/UseCase/Command/User/ChangeEmail/ChangeEmailCommandHandler.php +++ b/src/Application/UseCase/Command/User/ChangeEmail/ChangeEmailCommandHandler.php @@ -8,7 +8,7 @@ use Acme\Domain\User\Specification\Checker\CustomerEmailUniquenessCheckerInterface; use Acme\Infrastructure\Shared\Bus\Command\CommandHandlerInterface; -class ChangeEmailCommandHandler implements CommandHandlerInterface +final class ChangeEmailCommandHandler implements CommandHandlerInterface { private UserRepositoryInterface $userRepository; diff --git a/src/Application/UseCase/Command/User/ChangeEmail/ChangeEmailDataTransformer.php b/src/Application/UseCase/Command/User/ChangeEmail/ChangeEmailDataTransformer.php index d342b64..4beae4b 100644 --- a/src/Application/UseCase/Command/User/ChangeEmail/ChangeEmailDataTransformer.php +++ b/src/Application/UseCase/Command/User/ChangeEmail/ChangeEmailDataTransformer.php @@ -8,7 +8,7 @@ use ApiPlatform\Core\Validator\ValidatorInterface; use Ramsey\Uuid\UuidInterface; -class ChangeEmailDataTransformer implements DataTransformerInterface +final class ChangeEmailDataTransformer implements DataTransformerInterface { private ValidatorInterface $validator; diff --git a/src/Application/UseCase/Command/User/ChangeEmail/ChangeEmailInput.php b/src/Application/UseCase/Command/User/ChangeEmail/ChangeEmailInput.php index fe82260..b9b0ab1 100644 --- a/src/Application/UseCase/Command/User/ChangeEmail/ChangeEmailInput.php +++ b/src/Application/UseCase/Command/User/ChangeEmail/ChangeEmailInput.php @@ -6,7 +6,7 @@ use Symfony\Component\Validator\Constraints as Assert; -class ChangeEmailInput +final class ChangeEmailInput { /** * @Assert\Email diff --git a/src/Domain/Organization/Event/BillingInformationWasUpdated.php b/src/Domain/Organization/Event/BillingInformationWasUpdated.php new file mode 100644 index 0000000..3e3c21f --- /dev/null +++ b/src/Domain/Organization/Event/BillingInformationWasUpdated.php @@ -0,0 +1,37 @@ +companyName = $companyName; + $this->email = $email; + $this->phoneNumber = $phoneNumber; + $this->companyAddress = $companyAddress; + $this->updatedAt = $updatedAt; + } +} diff --git a/src/Domain/Organization/Event/OrganizationWasCreated.php b/src/Domain/Organization/Event/OrganizationWasCreated.php new file mode 100644 index 0000000..2c3e3a6 --- /dev/null +++ b/src/Domain/Organization/Event/OrganizationWasCreated.php @@ -0,0 +1,33 @@ +uuid = $uuid; + $this->profile = $profile; + $this->address = $address; + $this->createdAt = $createdAt; + } +} diff --git a/src/Domain/Organization/Organization.php b/src/Domain/Organization/Organization.php new file mode 100644 index 0000000..b1b8cf7 --- /dev/null +++ b/src/Domain/Organization/Organization.php @@ -0,0 +1,73 @@ +addDomainEvent( + new OrganizationWasCreated($uuid, $organizationProfile, $address, DateTime::now()) + ); + + return $organization; + } + + public function updateBillingInformation( + string $companyName, + Email $email, + PhoneNumber $phoneNumber, + Address $address + ): void { + $this->addDomainEvent( + new BillingInformationWasUpdated($companyName, $email, $phoneNumber, $address, DateTime::now()) + ); + } + + protected function applyOrganizationWasCreated(OrganizationWasCreated $event): void + { + $this->uuid = $event->uuid; + $this->profile = $event->profile; + $this->address = $event->address; + $this->createdAt = $event->createdAt; + $this->updatedAt = $event->createdAt; + } + + protected function applyBillingInformationWasUpdated(BillingInformationWasUpdated $event): void + { + $this->billingInformation = new BillingInformation( + $event->companyName, $event->companyAddress, $event->phoneNumber, $event->email + ); + $this->updatedAt = $event->updatedAt; + } +} diff --git a/src/Domain/Organization/Repository/OrganizationRepositoryInterface.php b/src/Domain/Organization/Repository/OrganizationRepositoryInterface.php new file mode 100644 index 0000000..ffd238a --- /dev/null +++ b/src/Domain/Organization/Repository/OrganizationRepositoryInterface.php @@ -0,0 +1,15 @@ +addressLine1 = $addressLine1; + $this->addressLine2 = $addressLine2; + $this->city = $city; + $this->region = $region; + $this->country = $country; + $this->zipCode = $zipCode; + } +} diff --git a/src/Domain/Organization/ValueObject/BillingInformation.php b/src/Domain/Organization/ValueObject/BillingInformation.php new file mode 100644 index 0000000..107cff3 --- /dev/null +++ b/src/Domain/Organization/ValueObject/BillingInformation.php @@ -0,0 +1,31 @@ +companyName = $companyName; + $this->companyAddress = $companyAddress; + $this->phoneNumber = $phoneNumber; + $this->email = $email; + } +} diff --git a/src/Domain/Organization/ValueObject/OrganizationProfile.php b/src/Domain/Organization/ValueObject/OrganizationProfile.php new file mode 100644 index 0000000..ecdb768 --- /dev/null +++ b/src/Domain/Organization/ValueObject/OrganizationProfile.php @@ -0,0 +1,24 @@ +name = $name; + $this->description = $description; + $this->shorDescription = $shorDescription; + } +} diff --git a/src/Domain/Shared/ValueObject/PhoneNumber.php b/src/Domain/Shared/ValueObject/PhoneNumber.php new file mode 100644 index 0000000..b69aa45 --- /dev/null +++ b/src/Domain/Shared/ValueObject/PhoneNumber.php @@ -0,0 +1,41 @@ +phoneNumber = $phoneNumber; + } + + public static function fromString(string $phoneNumber): self + { + $util = PhoneNumberUtil::getInstance(); + try { + $phoneNumberObject = $util->parse($phoneNumber); + } catch (NumberParseException $e) { + throw new \InvalidArgumentException('Not a valid phone number'); + } + + return new self($util->format($phoneNumberObject, PhoneNumberFormat::E164)); + } + + public function toString(): string + { + return $this->phoneNumber; + } + + public function __toString(): string + { + return $this->phoneNumber; + } +} diff --git a/src/Infrastructure/Organization/Doctrine/Orm/Mapping/Organization.orm.xml b/src/Infrastructure/Organization/Doctrine/Orm/Mapping/Organization.orm.xml new file mode 100644 index 0000000..5d09683 --- /dev/null +++ b/src/Infrastructure/Organization/Doctrine/Orm/Mapping/Organization.orm.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/Infrastructure/Organization/Doctrine/Orm/Mapping/ValueObject.Address.orm.xml b/src/Infrastructure/Organization/Doctrine/Orm/Mapping/ValueObject.Address.orm.xml new file mode 100644 index 0000000..a0d2a51 --- /dev/null +++ b/src/Infrastructure/Organization/Doctrine/Orm/Mapping/ValueObject.Address.orm.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/Infrastructure/Organization/Doctrine/Orm/Mapping/ValueObject.BillingInformation.orm.xml b/src/Infrastructure/Organization/Doctrine/Orm/Mapping/ValueObject.BillingInformation.orm.xml new file mode 100644 index 0000000..547b3f2 --- /dev/null +++ b/src/Infrastructure/Organization/Doctrine/Orm/Mapping/ValueObject.BillingInformation.orm.xml @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/src/Infrastructure/Organization/Doctrine/Orm/Mapping/ValueObject.OrganizationProfile.orm.xml b/src/Infrastructure/Organization/Doctrine/Orm/Mapping/ValueObject.OrganizationProfile.orm.xml new file mode 100644 index 0000000..8f1329f --- /dev/null +++ b/src/Infrastructure/Organization/Doctrine/Orm/Mapping/ValueObject.OrganizationProfile.orm.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/src/Infrastructure/Organization/Repository/OrganizationStore.php b/src/Infrastructure/Organization/Repository/OrganizationStore.php new file mode 100644 index 0000000..f3d5eca --- /dev/null +++ b/src/Infrastructure/Organization/Repository/OrganizationStore.php @@ -0,0 +1,37 @@ +oneByIdOrException($uuid->getBytes()); + } + + public function store(Organization $organization): void + { + $this->register($organization); + } +} diff --git a/src/Infrastructure/Shared/Doctrine/PhoneNumberType.php b/src/Infrastructure/Shared/Doctrine/PhoneNumberType.php new file mode 100644 index 0000000..847f86e --- /dev/null +++ b/src/Infrastructure/Shared/Doctrine/PhoneNumberType.php @@ -0,0 +1,55 @@ +getName(), ['null', PhoneNumber::class]); + } + + return $value->toString(); + } + + public function convertToPHPValue($value, AbstractPlatform $platform) + { + if (null === $value || $value instanceof PhoneNumber) { + return $value; + } + + try { + $phoneNumber = PhoneNumber::fromString($value); + } catch (Throwable $e) { + throw ConversionException::conversionFailedFormat($value, $this->getName(), + $platform->getDateTimeFormatString()); + } + + return $phoneNumber; + } + + public function requiresSQLCommentHint(AbstractPlatform $platform) + { + return true; + } + + public function getName() + { + return self::TYPE; + } +} diff --git a/src/Infrastructure/Shared/Migration/2020/09/Version20200922090134.php b/src/Infrastructure/Shared/Migration/2020/09/Version20200922090134.php new file mode 100644 index 0000000..96ca5fc --- /dev/null +++ b/src/Infrastructure/Shared/Migration/2020/09/Version20200922090134.php @@ -0,0 +1,31 @@ +addSql('CREATE TABLE organization (uuid BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid_binary)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', profile_name VARCHAR(255) NOT NULL, profile_description LONGTEXT NOT NULL, profile_shor_description LONGTEXT NOT NULL, billing_information_company_name VARCHAR(255) DEFAULT NULL, billing_information_phone_number VARCHAR(255) DEFAULT NULL COMMENT \'(DC2Type:phone_number)\', billing_information_email VARCHAR(255) DEFAULT NULL COMMENT \'(DC2Type:email)\', billing_information_company_address_addressLine1 VARCHAR(255) DEFAULT NULL, billing_information_company_address_addressLine2 VARCHAR(255) DEFAULT NULL, billing_information_company_address_city VARCHAR(255) DEFAULT NULL, billing_information_company_address_region VARCHAR(255) DEFAULT NULL, billing_information_company_address_country VARCHAR(255) DEFAULT NULL, billing_information_company_address_zipCode VARCHAR(255) DEFAULT NULL, address_addressLine1 VARCHAR(255) DEFAULT NULL, address_addressLine2 VARCHAR(255) DEFAULT NULL, address_city VARCHAR(255) DEFAULT NULL, address_region VARCHAR(255) DEFAULT NULL, address_country VARCHAR(255) DEFAULT NULL, address_zipCode VARCHAR(255) DEFAULT NULL, PRIMARY KEY(uuid)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('DROP TABLE organization'); + } +} diff --git a/symfony.lock b/symfony.lock index 7b954d7..768609d 100644 --- a/symfony.lock +++ b/symfony.lock @@ -104,6 +104,12 @@ "fig/link-util": { "version": "1.1.1" }, + "giggsey/libphonenumber-for-php": { + "version": "8.12.9" + }, + "giggsey/locale": { + "version": "1.9" + }, "lcobucci/jwt": { "version": "3.3.3" },