#1149 -- Consolidate fromArray/toArray and Serializer, add smart type casting.

This commit is contained in:
Buster "Silver Eagle" Neece 2019-02-05 11:22:05 -06:00
parent c5b2cb5220
commit d9a5eeed13
5 changed files with 129 additions and 501 deletions

View File

@ -39,8 +39,6 @@
"symfony/finder": "^4.1",
"symfony/process": "^4.1",
"symfony/property-access": "^4.2",
"symfony/serializer": "^4.2",
"symfony/validator": "^4.2",
"ramsey/uuid": "^3.8",
"wikimedia/composer-merge-plugin": "^1.4",
"zircote/swagger-php": "^3.0"

250
composer.lock generated
View File

@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "d2ff96e51f34be2fc3034d4beaa4f30f",
"content-hash": "5930a9ec972c64b73a8ed2bf39d8100c",
"packages": [
{
"name": "aws/aws-sdk-php",
"version": "3.87.2",
"version": "3.87.3",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "7c00779a343c9b813628bf6a27b94945272ced93"
"reference": "5f9caa48b7871ff24231898c01f51580a83f59b9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/7c00779a343c9b813628bf6a27b94945272ced93",
"reference": "7c00779a343c9b813628bf6a27b94945272ced93",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/5f9caa48b7871ff24231898c01f51580a83f59b9",
"reference": "5f9caa48b7871ff24231898c01f51580a83f59b9",
"shasum": ""
},
"require": {
@ -87,7 +87,7 @@
"s3",
"sdk"
],
"time": "2019-01-25T22:29:49+00:00"
"time": "2019-02-04T22:38:14+00:00"
},
{
"name": "azuracast/azuracore",
@ -95,12 +95,12 @@
"source": {
"type": "git",
"url": "https://github.com/AzuraCast/azuracore.git",
"reference": "c699e4af4bffa18869de26676e20c244140caa71"
"reference": "ecf6362ae7ee8403f626b9fcfac0e6767f00378d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/AzuraCast/azuracore/zipball/c699e4af4bffa18869de26676e20c244140caa71",
"reference": "c699e4af4bffa18869de26676e20c244140caa71",
"url": "https://api.github.com/repos/AzuraCast/azuracore/zipball/ecf6362ae7ee8403f626b9fcfac0e6767f00378d",
"reference": "ecf6362ae7ee8403f626b9fcfac0e6767f00378d",
"shasum": ""
},
"require": {
@ -120,6 +120,8 @@
"slim/slim": "^3.0",
"symfony/console": "^4.1",
"symfony/event-dispatcher": "^4.1",
"symfony/serializer": "^4.2",
"symfony/validator": "^4.2",
"symfony/var-dumper": "^4.1",
"zendframework/zend-config": "^3.1.0"
},
@ -148,7 +150,7 @@
}
],
"description": "A lightweight core application framework.",
"time": "2019-02-01T00:49:55+00:00"
"time": "2019-02-05T17:08:40+00:00"
},
{
"name": "azuracast/azuraforms",
@ -2081,12 +2083,12 @@
"source": {
"type": "git",
"url": "https://github.com/JamesHeinrich/getID3.git",
"reference": "e3abc4dd334ff537870b7ee9091b1751e46e4d14"
"reference": "2ffe91703f90e187b1feeca3ae8f5f83a72db41b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JamesHeinrich/getID3/zipball/e3abc4dd334ff537870b7ee9091b1751e46e4d14",
"reference": "e3abc4dd334ff537870b7ee9091b1751e46e4d14",
"url": "https://api.github.com/repos/JamesHeinrich/getID3/zipball/2ffe91703f90e187b1feeca3ae8f5f83a72db41b",
"reference": "2ffe91703f90e187b1feeca3ae8f5f83a72db41b",
"shasum": ""
},
"require": {
@ -2136,20 +2138,20 @@
"php",
"tags"
],
"time": "2019-01-26T17:17:08+00:00"
"time": "2019-02-02T00:49:21+00:00"
},
{
"name": "league/flysystem",
"version": "1.0.49",
"version": "1.0.50",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "a63cc83d8a931b271be45148fa39ba7156782ffd"
"reference": "dab4e7624efa543a943be978008f439c333f2249"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a63cc83d8a931b271be45148fa39ba7156782ffd",
"reference": "a63cc83d8a931b271be45148fa39ba7156782ffd",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/dab4e7624efa543a943be978008f439c333f2249",
"reference": "dab4e7624efa543a943be978008f439c333f2249",
"shasum": ""
},
"require": {
@ -2220,7 +2222,7 @@
"sftp",
"storage"
],
"time": "2018-11-23T23:41:29+00:00"
"time": "2019-02-01T08:50:36+00:00"
},
{
"name": "league/flysystem-aws-s3-v3",
@ -4050,16 +4052,16 @@
},
{
"name": "symfony/console",
"version": "v4.2.2",
"version": "v4.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "b0a03c1bb0fcbe288629956cf2f1dd3f1dc97522"
"reference": "1f0ad51dfde4da8a6070f06adc58b4e37cbb37a4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/b0a03c1bb0fcbe288629956cf2f1dd3f1dc97522",
"reference": "b0a03c1bb0fcbe288629956cf2f1dd3f1dc97522",
"url": "https://api.github.com/repos/symfony/console/zipball/1f0ad51dfde4da8a6070f06adc58b4e37cbb37a4",
"reference": "1f0ad51dfde4da8a6070f06adc58b4e37cbb37a4",
"shasum": ""
},
"require": {
@ -4071,6 +4073,9 @@
"symfony/dependency-injection": "<3.4",
"symfony/process": "<3.3"
},
"provide": {
"psr/log-implementation": "1.0"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~3.4|~4.0",
@ -4080,7 +4085,7 @@
"symfony/process": "~3.4|~4.0"
},
"suggest": {
"psr/log-implementation": "For using the console logger",
"psr/log": "For using the console logger",
"symfony/event-dispatcher": "",
"symfony/lock": "",
"symfony/process": ""
@ -4115,7 +4120,7 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2019-01-04T15:13:53+00:00"
"time": "2019-01-25T14:35:16+00:00"
},
{
"name": "symfony/contracts",
@ -4187,16 +4192,16 @@
},
{
"name": "symfony/event-dispatcher",
"version": "v4.2.2",
"version": "v4.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "887de6d34c86cf0cb6cbf910afb170cdb743cb5e"
"reference": "bd09ad265cd50b2b9d09d65ce6aba2d29bc81fe1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/887de6d34c86cf0cb6cbf910afb170cdb743cb5e",
"reference": "887de6d34c86cf0cb6cbf910afb170cdb743cb5e",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/bd09ad265cd50b2b9d09d65ce6aba2d29bc81fe1",
"reference": "bd09ad265cd50b2b9d09d65ce6aba2d29bc81fe1",
"shasum": ""
},
"require": {
@ -4247,20 +4252,20 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"time": "2019-01-05T16:37:49+00:00"
"time": "2019-01-16T20:35:37+00:00"
},
{
"name": "symfony/finder",
"version": "v4.2.2",
"version": "v4.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "9094d69e8c6ee3fe186a0ec5a4f1401e506071ce"
"reference": "ef71816cbb264988bb57fe6a73f610888b9aa70c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/9094d69e8c6ee3fe186a0ec5a4f1401e506071ce",
"reference": "9094d69e8c6ee3fe186a0ec5a4f1401e506071ce",
"url": "https://api.github.com/repos/symfony/finder/zipball/ef71816cbb264988bb57fe6a73f610888b9aa70c",
"reference": "ef71816cbb264988bb57fe6a73f610888b9aa70c",
"shasum": ""
},
"require": {
@ -4296,20 +4301,20 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2019-01-03T09:07:35+00:00"
"time": "2019-01-16T20:35:37+00:00"
},
{
"name": "symfony/inflector",
"version": "v4.2.2",
"version": "v4.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/inflector.git",
"reference": "9f64271222922ef1a10e43f77d88baf72bf22b0e"
"reference": "275e54941a4f17a471c68d2a00e2513fc1fd4a78"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/inflector/zipball/9f64271222922ef1a10e43f77d88baf72bf22b0e",
"reference": "9f64271222922ef1a10e43f77d88baf72bf22b0e",
"url": "https://api.github.com/repos/symfony/inflector/zipball/275e54941a4f17a471c68d2a00e2513fc1fd4a78",
"reference": "275e54941a4f17a471c68d2a00e2513fc1fd4a78",
"shasum": ""
},
"require": {
@ -4354,20 +4359,20 @@
"symfony",
"words"
],
"time": "2019-01-03T09:07:35+00:00"
"time": "2019-01-16T20:31:39+00:00"
},
{
"name": "symfony/options-resolver",
"version": "v4.2.2",
"version": "v4.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
"reference": "fbcb106aeee72f3450298bf73324d2cc00d083d1"
"reference": "831b272963a8aa5a0613a1a7f013322d8161bbbb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/fbcb106aeee72f3450298bf73324d2cc00d083d1",
"reference": "fbcb106aeee72f3450298bf73324d2cc00d083d1",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/831b272963a8aa5a0613a1a7f013322d8161bbbb",
"reference": "831b272963a8aa5a0613a1a7f013322d8161bbbb",
"shasum": ""
},
"require": {
@ -4408,7 +4413,7 @@
"configuration",
"options"
],
"time": "2019-01-03T09:07:35+00:00"
"time": "2019-01-16T21:31:25+00:00"
},
{
"name": "symfony/polyfill-ctype",
@ -4584,16 +4589,16 @@
},
{
"name": "symfony/process",
"version": "v4.2.2",
"version": "v4.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "ea043ab5d8ed13b467a9087d81cb876aee7f689a"
"reference": "6c05edb11fbeff9e2b324b4270ecb17911a8b7ad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/ea043ab5d8ed13b467a9087d81cb876aee7f689a",
"reference": "ea043ab5d8ed13b467a9087d81cb876aee7f689a",
"url": "https://api.github.com/repos/symfony/process/zipball/6c05edb11fbeff9e2b324b4270ecb17911a8b7ad",
"reference": "6c05edb11fbeff9e2b324b4270ecb17911a8b7ad",
"shasum": ""
},
"require": {
@ -4629,20 +4634,20 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2019-01-03T14:48:52+00:00"
"time": "2019-01-24T22:05:03+00:00"
},
{
"name": "symfony/property-access",
"version": "v4.2.2",
"version": "v4.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/property-access.git",
"reference": "a21d40670000f61a1a4b90a607d54696aad914cd"
"reference": "4768734a803c4471b7a733bd13698d91dd0cf193"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-access/zipball/a21d40670000f61a1a4b90a607d54696aad914cd",
"reference": "a21d40670000f61a1a4b90a607d54696aad914cd",
"url": "https://api.github.com/repos/symfony/property-access/zipball/4768734a803c4471b7a733bd13698d91dd0cf193",
"reference": "4768734a803c4471b7a733bd13698d91dd0cf193",
"shasum": ""
},
"require": {
@ -4696,20 +4701,20 @@
"property path",
"reflection"
],
"time": "2019-01-05T16:37:49+00:00"
"time": "2019-01-16T20:31:39+00:00"
},
{
"name": "symfony/serializer",
"version": "v4.2.2",
"version": "v4.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/serializer.git",
"reference": "0e696a2a8ce2648a8b1074fc9aedd9fdd328ba77"
"reference": "95e63a14718cc0825ca2f9c2d85a7129d8f12f13"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/serializer/zipball/0e696a2a8ce2648a8b1074fc9aedd9fdd328ba77",
"reference": "0e696a2a8ce2648a8b1074fc9aedd9fdd328ba77",
"url": "https://api.github.com/repos/symfony/serializer/zipball/95e63a14718cc0825ca2f9c2d85a7129d8f12f13",
"reference": "95e63a14718cc0825ca2f9c2d85a7129d8f12f13",
"shasum": ""
},
"require": {
@ -4776,20 +4781,20 @@
],
"description": "Symfony Serializer Component",
"homepage": "https://symfony.com",
"time": "2019-01-03T09:07:35+00:00"
"time": "2019-01-29T09:49:29+00:00"
},
{
"name": "symfony/validator",
"version": "v4.2.2",
"version": "v4.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/validator.git",
"reference": "f89d2fab883a6a20d0d0093537392763cf52f0ba"
"reference": "f051f6bdc89b414a899c4652570352a4cdf5a868"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/validator/zipball/f89d2fab883a6a20d0d0093537392763cf52f0ba",
"reference": "f89d2fab883a6a20d0d0093537392763cf52f0ba",
"url": "https://api.github.com/repos/symfony/validator/zipball/f051f6bdc89b414a899c4652570352a4cdf5a868",
"reference": "f051f6bdc89b414a899c4652570352a4cdf5a868",
"shasum": ""
},
"require": {
@ -4865,20 +4870,20 @@
],
"description": "Symfony Validator Component",
"homepage": "https://symfony.com",
"time": "2019-01-06T14:13:54+00:00"
"time": "2019-01-30T11:44:30+00:00"
},
{
"name": "symfony/var-dumper",
"version": "v4.2.2",
"version": "v4.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "85bde661b178173d85c6f11ea9d03b61d1212bb2"
"reference": "223bda89f9be41cf7033eeaf11bc61a280489c17"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/85bde661b178173d85c6f11ea9d03b61d1212bb2",
"reference": "85bde661b178173d85c6f11ea9d03b61d1212bb2",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/223bda89f9be41cf7033eeaf11bc61a280489c17",
"reference": "223bda89f9be41cf7033eeaf11bc61a280489c17",
"shasum": ""
},
"require": {
@ -4941,20 +4946,20 @@
"debug",
"dump"
],
"time": "2019-01-03T09:07:35+00:00"
"time": "2019-01-30T11:44:30+00:00"
},
{
"name": "symfony/yaml",
"version": "v4.2.2",
"version": "v4.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "d0aa6c0ea484087927b49fd513383a7d36190ca6"
"reference": "d461670ee145092b7e2a56c1da7118f19cadadb0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/d0aa6c0ea484087927b49fd513383a7d36190ca6",
"reference": "d0aa6c0ea484087927b49fd513383a7d36190ca6",
"url": "https://api.github.com/repos/symfony/yaml/zipball/d461670ee145092b7e2a56c1da7118f19cadadb0",
"reference": "d461670ee145092b7e2a56c1da7118f19cadadb0",
"shasum": ""
},
"require": {
@ -5000,7 +5005,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2019-01-03T09:07:35+00:00"
"time": "2019-01-16T20:35:37+00:00"
},
{
"name": "wikimedia/composer-merge-plugin",
@ -5390,16 +5395,16 @@
},
{
"name": "codeception/codeception",
"version": "2.5.2",
"version": "2.5.3",
"source": {
"type": "git",
"url": "https://github.com/Codeception/Codeception.git",
"reference": "4f89de32929fef53ca6d83b159fe329b6d484c1c"
"reference": "19f0fe845c0af5af2a6c094dc0df3a178a3fd5b0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Codeception/Codeception/zipball/4f89de32929fef53ca6d83b159fe329b6d484c1c",
"reference": "4f89de32929fef53ca6d83b159fe329b6d484c1c",
"url": "https://api.github.com/repos/Codeception/Codeception/zipball/19f0fe845c0af5af2a6c094dc0df3a178a3fd5b0",
"reference": "19f0fe845c0af5af2a6c094dc0df3a178a3fd5b0",
"shasum": ""
},
"require": {
@ -5431,7 +5436,7 @@
"predis/predis": "^1.0",
"squizlabs/php_codesniffer": "~2.0",
"symfony/process": ">=2.7 <5.0",
"vlucas/phpdotenv": "^2.4.0"
"vlucas/phpdotenv": "^3.0"
},
"suggest": {
"aws/aws-sdk-php": "For using AWS Auth in REST module and Queue module",
@ -5478,7 +5483,7 @@
"functional testing",
"unit testing"
],
"time": "2019-01-02T10:28:51+00:00"
"time": "2019-02-02T15:39:58+00:00"
},
{
"name": "codeception/phpunit-wrapper",
@ -7282,16 +7287,16 @@
},
{
"name": "phpunit/phpunit",
"version": "7.5.2",
"version": "7.5.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "7c89093bd00f7d5ddf0ab81dee04f801416b4944"
"reference": "2cb759721e53bc05f56487f628c6b9fbb6c18746"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7c89093bd00f7d5ddf0ab81dee04f801416b4944",
"reference": "7c89093bd00f7d5ddf0ab81dee04f801416b4944",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2cb759721e53bc05f56487f628c6b9fbb6c18746",
"reference": "2cb759721e53bc05f56487f628c6b9fbb6c18746",
"shasum": ""
},
"require": {
@ -7362,7 +7367,7 @@
"testing",
"xunit"
],
"time": "2019-01-15T08:19:08+00:00"
"time": "2019-02-01T05:24:07+00:00"
},
{
"name": "roave/security-advisories",
@ -7370,12 +7375,12 @@
"source": {
"type": "git",
"url": "https://github.com/Roave/SecurityAdvisories.git",
"reference": "db876706aacd4ffbd1c253358d19a651e50e65c2"
"reference": "e1b9176e35e8a4521c8b9720f4b5601d5caa68c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/db876706aacd4ffbd1c253358d19a651e50e65c2",
"reference": "db876706aacd4ffbd1c253358d19a651e50e65c2",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/e1b9176e35e8a4521c8b9720f4b5601d5caa68c5",
"reference": "e1b9176e35e8a4521c8b9720f4b5601d5caa68c5",
"shasum": ""
},
"conflict": {
@ -7410,8 +7415,8 @@
"doctrine/mongodb-odm-bundle": ">=2,<3.0.1",
"doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1",
"dompdf/dompdf": ">=0.6,<0.6.2",
"drupal/core": ">=7,<7.60|>=8,<8.5.8|>=8.6,<8.6.2",
"drupal/drupal": ">=7,<7.60|>=8,<8.5.8|>=8.6,<8.6.2",
"drupal/core": ">=7,<7.62|>=8,<8.6.6",
"drupal/drupal": ">=7,<7.62|>=8,<8.6.6",
"erusev/parsedown": "<1.7",
"ezsystems/ezpublish-kernel": ">=5.3,<5.3.12.1|>=5.4,<5.4.13.1|>=6,<6.7.9.1|>=6.8,<6.13.5.1|>=7,<7.2.4.1|>=7.3,<7.3.2.1",
"ezsystems/ezpublish-legacy": ">=5.3,<5.3.12.6|>=5.4,<5.4.12.3|>=2011,<2017.12.4.3|>=2018.6,<2018.6.1.4|>=2018.9,<2018.9.1.3",
@ -7508,7 +7513,7 @@
"symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7",
"tecnickcom/tcpdf": "<6.2.22",
"thelia/backoffice-default-template": ">=2.1,<2.1.2",
"thelia/thelia": ">=2.1.0-beta1,<2.1.3|>=2.1,<2.1.2",
"thelia/thelia": ">=2.1,<2.1.2|>=2.1.0-beta1,<2.1.3",
"theonedemon/phpwhois": "<=4.2.5",
"titon/framework": ">=0,<9.9.99",
"truckersmp/phpwhois": "<=4.3.1",
@ -7566,7 +7571,7 @@
}
],
"description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it",
"time": "2019-01-22T18:37:22+00:00"
"time": "2019-02-03T13:48:05+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
@ -7679,23 +7684,23 @@
},
{
"name": "sebastian/diff",
"version": "3.0.1",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "366541b989927187c4ca70490a35615d3fef2dce"
"reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/366541b989927187c4ca70490a35615d3fef2dce",
"reference": "366541b989927187c4ca70490a35615d3fef2dce",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29",
"reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^7.0",
"phpunit/phpunit": "^7.5 || ^8.0",
"symfony/process": "^2 || ^3.3 || ^4"
},
"type": "library",
@ -7731,32 +7736,35 @@
"unidiff",
"unified diff"
],
"time": "2018-06-10T07:54:39+00:00"
"time": "2019-02-04T06:01:07+00:00"
},
{
"name": "sebastian/environment",
"version": "4.0.2",
"version": "4.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "4a43e9af57b4afa663077b9bc85255dbc6e8a2bd"
"reference": "6fda8ce1974b62b14935adc02a9ed38252eca656"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4a43e9af57b4afa663077b9bc85255dbc6e8a2bd",
"reference": "4a43e9af57b4afa663077b9bc85255dbc6e8a2bd",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6fda8ce1974b62b14935adc02a9ed38252eca656",
"reference": "6fda8ce1974b62b14935adc02a9ed38252eca656",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^7.4"
"phpunit/phpunit": "^7.5"
},
"suggest": {
"ext-posix": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
"dev-master": "4.1-dev"
}
},
"autoload": {
@ -7781,7 +7789,7 @@
"environment",
"hhvm"
],
"time": "2019-01-28T15:26:03+00:00"
"time": "2019-02-01T05:27:49+00:00"
},
{
"name": "sebastian/exporter",
@ -8184,16 +8192,16 @@
},
{
"name": "symfony/browser-kit",
"version": "v4.2.2",
"version": "v4.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/browser-kit.git",
"reference": "313512c878805971aebddb5d1707bcf3f4e25df7"
"reference": "ee4462581eb54bf34b746e4a5d522a4f21620160"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/313512c878805971aebddb5d1707bcf3f4e25df7",
"reference": "313512c878805971aebddb5d1707bcf3f4e25df7",
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/ee4462581eb54bf34b746e4a5d522a4f21620160",
"reference": "ee4462581eb54bf34b746e4a5d522a4f21620160",
"shasum": ""
},
"require": {
@ -8237,20 +8245,20 @@
],
"description": "Symfony BrowserKit Component",
"homepage": "https://symfony.com",
"time": "2019-01-03T09:07:35+00:00"
"time": "2019-01-16T21:31:25+00:00"
},
{
"name": "symfony/css-selector",
"version": "v4.2.2",
"version": "v4.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "76dac1dbe2830213e95892c7c2ec1edd74113ea4"
"reference": "48eddf66950fa57996e1be4a55916d65c10c604a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/76dac1dbe2830213e95892c7c2ec1edd74113ea4",
"reference": "76dac1dbe2830213e95892c7c2ec1edd74113ea4",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/48eddf66950fa57996e1be4a55916d65c10c604a",
"reference": "48eddf66950fa57996e1be4a55916d65c10c604a",
"shasum": ""
},
"require": {
@ -8290,20 +8298,20 @@
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"time": "2019-01-03T09:07:35+00:00"
"time": "2019-01-16T20:31:39+00:00"
},
{
"name": "symfony/dom-crawler",
"version": "v4.2.2",
"version": "v4.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
"reference": "8dc06251d5ad98d8494e1f742bec9cfdb9e42044"
"reference": "d8476760b04cdf7b499c8718aa437c20a9155103"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/8dc06251d5ad98d8494e1f742bec9cfdb9e42044",
"reference": "8dc06251d5ad98d8494e1f742bec9cfdb9e42044",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/d8476760b04cdf7b499c8718aa437c20a9155103",
"reference": "d8476760b04cdf7b499c8718aa437c20a9155103",
"shasum": ""
},
"require": {
@ -8347,7 +8355,7 @@
],
"description": "Symfony DomCrawler Component",
"homepage": "https://symfony.com",
"time": "2019-01-03T09:07:35+00:00"
"time": "2019-01-16T20:35:37+00:00"
},
{
"name": "theseer/tokenizer",

View File

@ -139,45 +139,6 @@ return function (\Azura\Container $di)
return $supervisor;
};
$di[\Doctrine\Common\Annotations\Reader::class] = function($di) {
/** @var \Azura\Settings $settings */
$settings = $di['settings'];
/** @var \Doctrine\Common\Cache\Cache $doctrine_cache */
$doctrine_cache = $di[\Doctrine\Common\Cache\Cache::class];
return new \Doctrine\Common\Annotations\CachedReader(
new \Doctrine\Common\Annotations\AnnotationReader,
$doctrine_cache,
!$settings->isProduction()
);
};
$di[\Symfony\Component\Serializer\Serializer::class] = function($di) {
/** @var \Doctrine\Common\Annotations\Reader $annotation_reader */
$annotation_reader = $di[\Doctrine\Common\Annotations\Reader::class];
$meta_factory = new \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory(
new \Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader($annotation_reader)
);
$normalizers = [
new \Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer(),
new \App\Normalizer\DoctrineEntityNormalizer($di[\Doctrine\ORM\EntityManager::class]),
new \Symfony\Component\Serializer\Normalizer\ObjectNormalizer($meta_factory),
];
return new Symfony\Component\Serializer\Serializer($normalizers);
};
$di[Symfony\Component\Validator\Validator\ValidatorInterface::class] = function($di) {
/** @var \Doctrine\Common\Annotations\Reader $annotation_reader */
$annotation_reader = $di[\Doctrine\Common\Annotations\Reader::class];
$builder = new \Symfony\Component\Validator\ValidatorBuilder();
$builder->enableAnnotationMapping($annotation_reader);
return $builder->getValidator();
};
$di->extend(\Azura\View::class, function(\Azura\View $view, \Azura\Container $di) {
$view->registerFunction('mailto', function ($address, $link_text = null) {

View File

@ -1,5 +0,0 @@
<?php
namespace App\Exception;
class NoGetterAvailable extends \Azura\Exception
{}

View File

@ -1,334 +0,0 @@
<?php
namespace App\Normalizer;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Proxy\Proxy;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait;
use Symfony\Component\Serializer\SerializerInterface;
class DoctrineEntityNormalizer extends AbstractNormalizer
{
use ObjectToPopulateTrait;
public const DEEP_NORMALIZE = 'deep';
public const NORMALIZE_TO_IDENTIFIERS = 'form_mode';
public const CLASS_METADATA = 'class_metadata';
public const ASSOCIATION_MAPPINGS = 'association_mappings';
/** @var EntityManager */
protected $em;
/** @var SerializerInterface|NormalizerInterface|DenormalizerInterface */
protected $serializer;
/**
* DoctrineEntityNormalizer constructor.
* @param EntityManager $em
*/
public function __construct(EntityManager $em)
{
parent::__construct();
$this->em = $em;
}
/**
* @param DenormalizerInterface|NormalizerInterface|SerializerInterface $serializer
*/
public function setSerializer($serializer): void
{
if (!$serializer instanceof DenormalizerInterface || !$serializer instanceof NormalizerInterface) {
throw new \InvalidArgumentException('Expected a serializer that also implements DenormalizerInterface and NormalizerInterface.');
}
$this->serializer = $serializer;
}
/**
* Replicates the "toArray" functionality previously present in Doctrine 1.
*
* @param mixed $object
* @param null $format
* @param array $context
* @return mixed
*/
public function normalize($object, $format = null, array $context = array())
{
if ($this->isCircularReference($object, $context)) {
return $this->handleCircularReference($object, $format, $context);
}
$context[self::CLASS_METADATA] = $this->em->getClassMetadata(get_class($object));
$reflect = new \ReflectionClass($object);
$props = $reflect->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED);
$return_arr = [];
if ($props) {
foreach ($props as $property) {
$attribute = $property->getName();
$value = $this->getAttributeValue($object, $attribute, $format, $context);
/** @var callable|null $callback */
$callback = $context[self::CALLBACKS][$attribute] ?? $this->defaultContext[self::CALLBACKS][$attribute] ?? $this->callbacks[$attribute] ?? null;
if ($callback) {
$value = $callback($value, $object, $attribute, $format, $context);
}
if (null !== $value) {
$return_arr[$attribute] = $value;
}
}
}
return $return_arr;
}
/**
* @param object $object
* @param string $prop_name
* @param null $format
* @param array $context
* @return mixed
*/
protected function getAttributeValue($object, $prop_name, $format = null, array $context = array())
{
$deep = $context[self::DEEP_NORMALIZE] ?? true;
$form_mode = $context[self::NORMALIZE_TO_IDENTIFIERS] ?? false;
$prop_info = $context[self::CLASS_METADATA]->fieldMappings[$prop_name] ?? [];
try {
$prop_val = $this->_get($object, $prop_name);
} catch(\App\Exception\NoGetterAvailable $e) {
return null;
}
if (is_array($prop_val)) {
return $prop_val;
}
if (!is_object($prop_val)) {
if ('array' === $prop_info['type']) {
return (array)$prop_val;
}
return (string)$prop_val;
}
if ($prop_val instanceof \DateTime) {
return $prop_val->getTimestamp();
}
if ($deep) {
if ($prop_val instanceof Collection) {
$return_val = [];
if (count($prop_val) > 0) {
foreach ($prop_val as $val_obj) {
if ($form_mode) {
$obj_meta = $this->em->getClassMetadata(get_class($val_obj));
$id_field = $obj_meta->identifier;
if ($id_field && count($id_field) === 1) {
$return_val[] = $this->_get($val_obj, $id_field[0]);
}
} else {
$return_val[] = $this->serializer->normalize($val_obj, $format, $context);
}
}
}
return $return_val;
}
return $this->serializer->normalize($prop_val, $format, $context);
}
return null;
}
/**
* Replicates the "fromArray" functionality previously present in Doctrine 1.
*
* @param mixed $data
* @param string $class
* @param string|null $format
* @param array $context
* @return object
*/
public function denormalize($data, $class, $format = null, array $context = array())
{
$object = $this->instantiateObject($data, $class, $context, new \ReflectionClass($class), false, $format);
$class = get_class($object);
$context[self::CLASS_METADATA] = $this->em->getMetadataFactory()->getMetadataFor($class);
$context[self::ASSOCIATION_MAPPINGS] = [];
if ($context[self::CLASS_METADATA]->associationMappings) {
foreach ($context[self::CLASS_METADATA]->associationMappings as $mapping_name => $mapping_info) {
$entity = $mapping_info['targetEntity'];
if (isset($mapping_info['joinTable'])) {
$context[self::ASSOCIATION_MAPPINGS][$mapping_info['fieldName']] = [
'type' => 'many',
'entity' => $entity,
'is_owning_side' => ($mapping_info['isOwningSide'] == 1),
];
} elseif (isset($mapping_info['joinColumns'])) {
foreach ($mapping_info['joinColumns'] as $col) {
$col_name = $col['name'];
$col_name = $context[self::CLASS_METADATA]->fieldNames[$col_name] ?? $col_name;
$context[self::ASSOCIATION_MAPPINGS][$mapping_name] = [
'name' => $col_name,
'type' => 'one',
'entity' => $entity,
];
}
}
}
}
foreach ((array)$data as $attribute => $value) {
/** @var callable|null $callback */
$callback = $context[self::CALLBACKS][$attribute] ?? $this->defaultContext[self::CALLBACKS][$attribute] ?? $this->callbacks[$attribute] ?? null;
if ($callback) {
$value = $callback($value, $object, $attribute, $format, $context);
}
$this->setAttributeValue($object, $attribute, $value, $format, $context);
}
return $object;
}
/**
* @param object $object
* @param string $field
* @param mixed $value
* @param null $format
* @param array $context
*/
protected function setAttributeValue($object, $field, $value, $format = null, array $context = array()): void
{
if (isset($context[self::ASSOCIATION_MAPPINGS][$field])) {
// Handle a mapping to another entity.
$mapping = $context[self::ASSOCIATION_MAPPINGS][$field];
if ('one' === $mapping['type']) {
if (empty($value)) {
$this->_set($object, $field, null);
} elseif (($field_item = $this->em->find($mapping['entity'], $value)) instanceof $mapping['entity']) {
$this->_set($object, $field, $field_item);
}
} else if ($mapping['is_owning_side']) {
$collection = $this->_get($object, $field);
if ($collection instanceof Collection) {
$collection->clear();
if ($value) {
foreach ((array)$value as $field_id) {
if (($field_item = $this->em->find($mapping['entity'], $field_id)) instanceof $mapping['entity']) {
$collection->add($field_item);
}
}
}
}
}
} else {
$this->_set($object, $field, $value);
}
}
/**
* @inheritdoc
*/
public function supportsNormalization($data, $format = null)
{
return $this->_isEntity($data);
}
/**
* @inheritdoc
*/
public function supportsDenormalization($data, $type, $format = null)
{
return $this->_isEntity($type);
}
/**
* @param object|string $class
* @return bool
*/
protected function _isEntity($class): bool
{
if (is_object($class)) {
$class = ($class instanceof Proxy)
? get_parent_class($class)
: get_class($class);
} else if (!is_string($class)) {
return false;
}
if (!class_exists($class)) {
return false;
}
return !$this->em->getMetadataFactory()->isTransient($class);
}
/**
* @param object $entity
* @param string $key
* @return mixed|null
*/
protected function _get($entity, $key)
{
// Default to "getStatus", "getConfig", etc...
$getter_method = $this->_getMethodName($key, 'get');
if (method_exists($entity, $getter_method)) {
return $entity->{$getter_method}();
}
// but also allow "isEnabled" instead of "getIsEnabled"
$raw_method = $this->_getMethodName($key);
if (method_exists($entity, $raw_method)) {
return $entity->{$raw_method}();
}
throw new \App\Exception\NoGetterAvailable(sprintf('No getter is available for property %s.', $key));
}
/**
* @param object $entity
* @param string $key
* @param mixed $value
* @return mixed|null
*/
protected function _set($entity, $key, $value)
{
$method_name = $this->_getMethodName($key, 'set');
return (method_exists($entity, $method_name))
? $entity->$method_name($value)
: null;
}
/**
* Converts "getvar_name_blah" to "getVarNameBlah".
*
* @param string $var
* @param string $prefix
* @return string
*/
protected function _getMethodName($var, $prefix = ''): string
{
return \Doctrine\Common\Inflector\Inflector::camelize(($prefix ? $prefix.'_' : '') . $var);
}
}