diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..3d8f399d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/vendor/ +/nbproject/ +/db/store.db diff --git a/.htaccess b/.htaccess new file mode 100644 index 00000000..d1b713a6 --- /dev/null +++ b/.htaccess @@ -0,0 +1,9 @@ + + Options -MultiViews + + RewriteEngine On + #RewriteBase /path/to/app + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [QSA,L] + \ No newline at end of file diff --git a/cli-config.php b/cli-config.php new file mode 100644 index 00000000..7557e003 --- /dev/null +++ b/cli-config.php @@ -0,0 +1,7 @@ +2.2,<2.4" + }, + "require-dev": { + "phpunit/phpunit": "~4.8|~5.0", + "predis/predis": "~1.0", + "satooshi/php-coveralls": "~0.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2016-10-29T11:16:17+00:00" + }, + { + "name": "doctrine/collections", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/1a4fb7e902202c33cce8c55989b945612943c2ba", + "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "doctrine/coding-standard": "~0.1@dev", + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "array", + "collections", + "iterator" + ], + "time": "2017-01-03T10:49:41+00:00" + }, + { + "name": "doctrine/common", + "version": "v2.7.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "930297026c8009a567ac051fd545bf6124150347" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/930297026c8009a567ac051fd545bf6124150347", + "reference": "930297026c8009a567ac051fd545bf6124150347", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": "~5.6|~7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common Library for Doctrine projects", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "collections", + "eventmanager", + "persistence", + "spl" + ], + "time": "2017-01-13T14:02:13+00:00" + }, + { + "name": "doctrine/dbal", + "version": "v2.5.12", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "7b9e911f9d8b30d43b96853dab26898c710d8f44" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/7b9e911f9d8b30d43b96853dab26898c710d8f44", + "reference": "7b9e911f9d8b30d43b96853dab26898c710d8f44", + "shasum": "" + }, + "require": { + "doctrine/common": ">=2.4,<2.8-dev", + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "symfony/console": "2.*||^3.0" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\DBAL\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Database Abstraction Layer", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "dbal", + "persistence", + "queryobject" + ], + "time": "2017-02-08T12:53:47+00:00" + }, + { + "name": "doctrine/inflector", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "90b2128806bfde671b6952ab8bea493942c1fdae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae", + "reference": "90b2128806bfde671b6952ab8bea493942c1fdae", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Inflector\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string" + ], + "time": "2015-11-06T14:35:42+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "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": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14T21:17:01+00:00" + }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09T13:34:57+00:00" + }, + { + "name": "doctrine/orm", + "version": "v2.5.6", + "source": { + "type": "git", + "url": "https://github.com/doctrine/doctrine2.git", + "reference": "e6c434196c8ef058239aaa0724b4aadb0107940b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/e6c434196c8ef058239aaa0724b4aadb0107940b", + "reference": "e6c434196c8ef058239aaa0724b4aadb0107940b", + "shasum": "" + }, + "require": { + "doctrine/cache": "~1.4", + "doctrine/collections": "~1.2", + "doctrine/common": ">=2.5-dev,<2.8-dev", + "doctrine/dbal": ">=2.5-dev,<2.6-dev", + "doctrine/instantiator": "~1.0.1", + "ext-pdo": "*", + "php": ">=5.4", + "symfony/console": "~2.5|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "symfony/yaml": "~2.3|~3.0" + }, + "suggest": { + "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" + }, + "bin": [ + "bin/doctrine", + "bin/doctrine.php" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\ORM\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Object-Relational-Mapper for PHP", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "orm" + ], + "time": "2016-12-18T15:42:34+00:00" + }, + { + "name": "pimple/pimple", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/a30f7d6e57565a2e1a316e1baf2a483f788b258a", + "reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.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": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ], + "time": "2015-09-11T15:10:35+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "silex/silex", + "version": "v2.1.0", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Silex.git", + "reference": "d5a9d9af14a1424ddecc3da481769cf64e7d3b34" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Silex/zipball/d5a9d9af14a1424ddecc3da481769cf64e7d3b34", + "reference": "d5a9d9af14a1424ddecc3da481769cf64e7d3b34", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "pimple/pimple": "~3.0", + "symfony/event-dispatcher": "~2.8|^3.0", + "symfony/http-foundation": "~2.8|^3.0", + "symfony/http-kernel": "~2.8|^3.0", + "symfony/routing": "~2.8|^3.0" + }, + "replace": { + "silex/api": "self.version", + "silex/providers": "self.version" + }, + "require-dev": { + "doctrine/dbal": "~2.2", + "monolog/monolog": "^1.4.1", + "swiftmailer/swiftmailer": "~5", + "symfony/asset": "~2.8|^3.0", + "symfony/browser-kit": "~2.8|^3.0", + "symfony/config": "~2.8|^3.0", + "symfony/css-selector": "~2.8|^3.0", + "symfony/debug": "~2.8|^3.0", + "symfony/doctrine-bridge": "~2.8|^3.0", + "symfony/dom-crawler": "~2.8|^3.0", + "symfony/expression-language": "~2.8|^3.0", + "symfony/finder": "~2.8|^3.0", + "symfony/form": "~2.8|^3.0", + "symfony/intl": "~2.8|^3.0", + "symfony/monolog-bridge": "~2.8|^3.0", + "symfony/options-resolver": "~2.8|^3.0", + "symfony/phpunit-bridge": "^3.2", + "symfony/process": "~2.8|^3.0", + "symfony/security": "~2.8|^3.0", + "symfony/serializer": "~2.8|^3.0", + "symfony/translation": "~2.8|^3.0", + "symfony/twig-bridge": "~2.8|^3.0", + "symfony/validator": "~2.8|^3.0", + "symfony/var-dumper": "~2.8|^3.0", + "symfony/web-link": "^3.3", + "twig/twig": "~1.28|~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Silex\\": "src/Silex" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + } + ], + "description": "The PHP micro-framework based on the Symfony Components", + "homepage": "http://silex.sensiolabs.org", + "keywords": [ + "microframework" + ], + "time": "2017-05-03T15:21:42+00:00" + }, + { + "name": "symfony/console", + "version": "v3.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "a7a17e0c6c3c4d70a211f80782e4b90ddadeaa38" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/a7a17e0c6c3c4d70a211f80782e4b90ddadeaa38", + "reference": "a7a17e0c6c3c4d70a211f80782e4b90ddadeaa38", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/debug": "~2.8|~3.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/filesystem": "~2.8|~3.0", + "symfony/process": "~2.8|~3.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/filesystem": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "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": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2017-04-26T01:39:17+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "fd6eeee656a5a7b384d56f1072243fe1c0e81686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/fd6eeee656a5a7b384d56f1072243fe1c0e81686", + "reference": "fd6eeee656a5a7b384d56f1072243fe1c0e81686", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/class-loader": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "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": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2017-04-19T20:17:50+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v3.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "b8a401f733b43251e1d088c589368b2a94155e40" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b8a401f733b43251e1d088c589368b2a94155e40", + "reference": "b8a401f733b43251e1d088c589368b2a94155e40", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/dependency-injection": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "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": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2017-05-01T14:58:48+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v3.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "9de6add7f731e5af7f5b2e9c0da365e43383ebef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/9de6add7f731e5af7f5b2e9c0da365e43383ebef", + "reference": "9de6add7f731e5af7f5b2e9c0da365e43383ebef", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/polyfill-mbstring": "~1.1" + }, + "require-dev": { + "symfony/expression-language": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "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": "Symfony HttpFoundation Component", + "homepage": "https://symfony.com", + "time": "2017-05-01T14:55:58+00:00" + }, + { + "name": "symfony/http-kernel", + "version": "v3.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "46e8b209abab55c072c47d72d5cd1d62c0585e05" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/46e8b209abab55c072c47d72d5cd1d62c0585e05", + "reference": "46e8b209abab55c072c47d72d5cd1d62c0585e05", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0", + "symfony/debug": "~2.8|~3.0", + "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/http-foundation": "~2.8.13|~3.1.6|~3.2" + }, + "conflict": { + "symfony/config": "<2.8" + }, + "require-dev": { + "symfony/browser-kit": "~2.8|~3.0", + "symfony/class-loader": "~2.8|~3.0", + "symfony/config": "~2.8|~3.0", + "symfony/console": "~2.8|~3.0", + "symfony/css-selector": "~2.8|~3.0", + "symfony/dependency-injection": "~2.8|~3.0", + "symfony/dom-crawler": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/finder": "~2.8|~3.0", + "symfony/process": "~2.8|~3.0", + "symfony/routing": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0", + "symfony/templating": "~2.8|~3.0", + "symfony/translation": "~2.8|~3.0", + "symfony/var-dumper": "~3.2" + }, + "suggest": { + "symfony/browser-kit": "", + "symfony/class-loader": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "", + "symfony/finder": "", + "symfony/var-dumper": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "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": "Symfony HttpKernel Component", + "homepage": "https://symfony.com", + "time": "2017-05-01T17:46:48+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.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": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2016-11-14T01:06:16+00:00" + }, + { + "name": "symfony/routing", + "version": "v3.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "5029745d6d463585e8b487dbc83d6333f408853a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/5029745d6d463585e8b487dbc83d6333f408853a", + "reference": "5029745d6d463585e8b487dbc83d6333f408853a", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "conflict": { + "symfony/config": "<2.8" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "doctrine/common": "~2.2", + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/http-foundation": "~2.8|~3.0", + "symfony/yaml": "~2.8|~3.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/dependency-injection": "For loading routes from a service", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "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": "Symfony Routing Component", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "time": "2017-04-12T14:13:17+00:00" + }, + { + "name": "symfony/serializer", + "version": "v3.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/serializer.git", + "reference": "6eeae1ba82005b761a53b7b8cf960bbf40c95986" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/serializer/zipball/6eeae1ba82005b761a53b7b8cf960bbf40c95986", + "reference": "6eeae1ba82005b761a53b7b8cf960bbf40c95986", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "conflict": { + "symfony/property-access": ">=3.0,<3.0.4|>=2.8,<2.8.4", + "symfony/property-info": "<3.1", + "symfony/yaml": "<3.1" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "doctrine/cache": "~1.0", + "phpdocumentor/reflection-docblock": "~3.0", + "symfony/cache": "~3.1", + "symfony/config": "~2.8|~3.0", + "symfony/http-foundation": "~2.8|~3.0", + "symfony/property-access": "~2.8|~3.0", + "symfony/property-info": "~3.1", + "symfony/yaml": "~3.1" + }, + "suggest": { + "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", + "doctrine/cache": "For using the default cached annotation reader and metadata cache.", + "psr/cache-implementation": "For using the metadata cache.", + "symfony/config": "For using the XML mapping loader.", + "symfony/http-foundation": "To use the DataUriNormalizer.", + "symfony/property-access": "For using the ObjectNormalizer.", + "symfony/property-info": "To deserialize relations.", + "symfony/yaml": "For using the default YAML mapping loader." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Serializer\\": "" + }, + "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": "Symfony Serializer Component", + "homepage": "https://symfony.com", + "time": "2017-05-01T14:55:58+00:00" + } + ], + "packages-dev": [ + { + "name": "symfony/var-dumper", + "version": "v3.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "fa47963ac7979ddbd42b2d646d1b056bddbf7bb8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/fa47963ac7979ddbd42b2d646d1b056bddbf7bb8", + "reference": "fa47963ac7979ddbd42b2d646d1b056bddbf7bb8", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" + }, + "require-dev": { + "ext-iconv": "*", + "twig/twig": "~1.20|~2.0" + }, + "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-symfony_debug": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "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": "Symfony mechanism for exploring and dumping PHP variables", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "time": "2017-05-01T14:55:58+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/index.php b/index.php new file mode 100644 index 00000000..9535abd6 --- /dev/null +++ b/index.php @@ -0,0 +1,33 @@ + 'pdo_sqlite', + 'path' => $dsn, +); + +$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode); +$entityManager = EntityManager::create($dbParams, $config); + +//dump($em); + +$app = new Silex\Application(); +$app['debug'] = true; +$app['db'] = $entityManager; + +$app->register(new Silex\Provider\SerializerServiceProvider()); + +$app->mount("/", include "src".DIRECTORY_SEPARATOR."Route".DIRECTORY_SEPARATOR."BaseController.php"); +$app->mount("/users", include "src".DIRECTORY_SEPARATOR."Route".DIRECTORY_SEPARATOR."UserController.php"); +$app->mount("/products", include "src".DIRECTORY_SEPARATOR."Route".DIRECTORY_SEPARATOR."ProductController.php"); + +$app->run(); \ No newline at end of file diff --git a/manual.pdf b/manual.pdf new file mode 100644 index 00000000..4845b31c Binary files /dev/null and b/manual.pdf differ diff --git a/src/Entity/ApiKey.php b/src/Entity/ApiKey.php new file mode 100644 index 00000000..8534d69e --- /dev/null +++ b/src/Entity/ApiKey.php @@ -0,0 +1,97 @@ +id; + } + + public function getKey() { + return $this->key; + } + + public function getUser_id() { + return $this->user_id; + } + + public function getCreatedAt() { + return $this->createdAt; + } + + public function getUpdatedAt() { + return $this->updatedAt; + } + + public function setId($id) { + $this->id = $id; + } + + public function setKey($key) { + $this->key = $key; + } + + public function setUser_id($user_id) { + $this->user_id = $user_id; + } + + public function setCreatedAt($createdAt) { + $this->createdAt = $createdAt; + } + + public function setUpdatedAt($updatedAt) { + $this->updatedAt = $updatedAt; + } + + public function updatedTimestamps() { + $this->setUpdatedAt(new \DateTime('now')); + + if ($this->getCreatedAt() == null) { + $this->setCreatedAt(new \DateTime('now')); + } + } + + public function createKey(){ + if ($this->getKey() == null) { + $this->setKey(uniqid("key_",true)); + } + } + +} diff --git a/src/Entity/ApiKeyListener.php b/src/Entity/ApiKeyListener.php new file mode 100644 index 00000000..45e1238f --- /dev/null +++ b/src/Entity/ApiKeyListener.php @@ -0,0 +1,15 @@ +createKey(); + $apikey->updatedTimestamps(); + return $apikey; + } + +} diff --git a/src/Entity/Product.php b/src/Entity/Product.php new file mode 100644 index 00000000..4181fabb --- /dev/null +++ b/src/Entity/Product.php @@ -0,0 +1,114 @@ +id; + } + + public function getName() { + return $this->name; + } + + public function getDescription() { + return $this->description; + } + + public function getPrice() { + return $this->price; + } + + public function getDiscount() { + return $this->discount; + } + + public function getCategory() { + return $this->category; + } + + public function getCreatedAt() { + return $this->createdAt; + } + + public function getUpdatedAt() { + return $this->updatedAt; + } + + public function setId($id) { + $this->id = $id; + } + + public function setName($name) { + $this->name = $name; + } + + public function setDescription($description) { + $this->description = $description; + } + + public function setPrice($price) { + $this->price = $price; + } + + public function setDiscount($discount) { + $this->discount = $discount; + } + + public function setCategory($category) { + $this->category = $category; + } + + public function setCreatedAt($createdAt) { + $this->createdAt = $createdAt; + } + + public function setUpdatedAt($updatedAt) { + $this->updatedAt = $updatedAt; + } + + public function updatedTimestamps() { + $this->setUpdatedAt(new \DateTime('now')); + + if ($this->getCreatedAt() == null) { + $this->setCreatedAt(new \DateTime('now')); + } + } + +} diff --git a/src/Entity/ProductListener.php b/src/Entity/ProductListener.php new file mode 100644 index 00000000..031325c1 --- /dev/null +++ b/src/Entity/ProductListener.php @@ -0,0 +1,15 @@ +updatedTimestamps(); + return $product; + } + +} diff --git a/src/Entity/User.php b/src/Entity/User.php new file mode 100644 index 00000000..dd65e808 --- /dev/null +++ b/src/Entity/User.php @@ -0,0 +1,80 @@ +id; + } + + public function getLogin() { + return $this->login; + } + + public function getPassword() { + return $this->password; + } + + public function getCreatedAt() { + return $this->createdAt; + } + + public function getUpdatedAt() { + return $this->updatedAt; + } + + public function setId($id) { + $this->id = $id; + } + + public function setLogin($login) { + $this->login = $login; + } + + public function setPassword($password) { + $this->password = $password; + } + + public function setCreatedAt($createdAt) { + $this->createdAt = $createdAt; + } + + public function setUpdatedAt($updatedAt) { + $this->updatedAt = $updatedAt; + } + + public function updatedTimestamps() { + $this->setUpdatedAt(new \DateTime('now')); + + if ($this->getCreatedAt() == null) { + $this->setCreatedAt(new \DateTime('now')); + } + } + +} diff --git a/src/Entity/UserListener.php b/src/Entity/UserListener.php new file mode 100644 index 00000000..b36dd1e0 --- /dev/null +++ b/src/Entity/UserListener.php @@ -0,0 +1,18 @@ +getPassword(); + if (strlen($password) < 60) { + $user->setPassword(password_hash($password, PASSWORD_DEFAULT)); + } + $user->updatedTimestamps(); + return $user; + } + +} diff --git a/src/Repository/ApiKeyRepository.php b/src/Repository/ApiKeyRepository.php new file mode 100644 index 00000000..288d1fa3 --- /dev/null +++ b/src/Repository/ApiKeyRepository.php @@ -0,0 +1,18 @@ +findOneBy(["user_id" => $user_id], ['id' => "desc"]); + } + + public function findOneByKey($key) { + return $this->findOneBy(["key" => $key]); + } + +} diff --git a/src/Repository/ProductRepository.php b/src/Repository/ProductRepository.php new file mode 100644 index 00000000..b5b50239 --- /dev/null +++ b/src/Repository/ProductRepository.php @@ -0,0 +1,22 @@ +findAll(); + } + + public function findProductByName($name) { + return $this->findOneBy(['name' => $name]); + } + public function findById($id) { + return $this->findOneBy(['id' => $id]); + } + +} diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php new file mode 100644 index 00000000..67aa4994 --- /dev/null +++ b/src/Repository/UserRepository.php @@ -0,0 +1,23 @@ +findAll(); + } + + public function findUser($login) { + return $this->findOneBy(['login' => $login]); + } + public function findUserById($id) { + return $this->findOneBy(['id' => $id]); + } + + + +} diff --git a/src/Route/BaseController.php b/src/Route/BaseController.php new file mode 100644 index 00000000..d44773ac --- /dev/null +++ b/src/Route/BaseController.php @@ -0,0 +1,25 @@ +get('/', function () use ($entityManager) { + +// $user = new \Entity\User(); +// $user->setLogin("Loko de droga"); +// $user->setPassword("loko"); +// +// $em->persist($user); +// $em->flush(); +// $dados =$entityManager->getRepository("Entity\User")->findUser('osmar'); + +// dump($app['db']['event_manager']->persist($user)); +// dump($dados ); + + return false; +}); + +return $base; diff --git a/src/Route/ProductController.php b/src/Route/ProductController.php new file mode 100644 index 00000000..3a74a155 --- /dev/null +++ b/src/Route/ProductController.php @@ -0,0 +1,116 @@ +get("id"); + + $product = $app['db']->getRepository("Entity\Product")->findById($id); + + + if (empty($product)) { + return new Response("Product not exists", 404); + } +}; + +$productApp->before(function (Request $request) use ($app) { + //check authorization + $key = $request->headers->get('key'); + $keyDb = $app['db']->getRepository("Entity\ApiKey")->findOneByKey($key); + + if (empty($keyDb)) { + return new Response("User Unauthorized", 401); + } + $app['db']->merge($keyDb); + $app['db']->flush(); +}); + +$productApp->match('/', function (Request $request) use($app) { + + $dataJson = json_decode($request->getContent(), true); + $product = new Product(); + + $product->setName($dataJson['name']); + $product->setPrice($dataJson['price']); + $product->setDiscount($dataJson['discount']); + $product->setDescription($dataJson['description']); + $product->setCategory($dataJson['category']); + + $app['db']->persist($product); + $app['db']->flush(); + + if ($product->getId() > 0) { + return new Response("Product created", 201); + } + return new Response("Product invalid", 404); +})->method('POST')->before(function (Request $request) use ($app) { + + $dataJson = json_decode($request->getContent(), true); + $product = $app['db']->getRepository("Entity\Product")->findProductByName($dataJson['name']); + + if (!empty($product)) { + return new Response("Product exists", 304); + } +}); + + +$productApp->get('/', function (Request $request) use ($app) { + + $products = $app['db']->getRepository("Entity\Product")->findAllProductsToArray(); + return $app->json($app['serializer']->normalize($products, 'json'), 200); +}); + +$productApp->get('/{id}', function ($id) use ($app) { + + $products = $app['db']->getRepository("Entity\Product")->findById($id); + return $app->json($app['serializer']->normalize($products, 'json'), 200); +})->assert('id', '\d+')->before($checkProductExist); + + +$productApp->put('/{id}', function (Request $request, $id) use($app) { + + + $dataJson = json_decode($request->getContent(), true); + $product = $app['db']->getRepository("Entity\Product")->findById($id); + + if (isset($dataJson['name'])) { + $product->setName($dataJson['name']); + } + if (isset($dataJson['description'])) { + $product->setDescription($dataJson['description']); + } + if (isset($dataJson['discount'])) { + $product->setDiscount($dataJson['discount']); + } + if (isset($dataJson['price'])) { + $product->setPrice($dataJson['price']); + } + if (isset($dataJson['category'])) { + $product->setCategory($dataJson['category']); + } + + $app['db']->merge($product); + $app['db']->flush(); + + if ($product->getId() > 0) { + return new Response("Product updated", 200); + } + return new Response("Product invalid", 403); +})->assert('id', '\d+')->before($checkProductExist); + +$productApp->delete('/{id}', function (Request $request, $id) use($app) { + + $product = $app['db']->getRepository("Entity\Product")->findById($id); + $app['db']->remove($product); + $app['db']->flush(); + ; + return new Response("Product removed", 200); +})->assert('id', '\d+')->before($checkProductExist); + + +return $productApp; diff --git a/src/Route/UserController.php b/src/Route/UserController.php new file mode 100644 index 00000000..fa69a910 --- /dev/null +++ b/src/Route/UserController.php @@ -0,0 +1,121 @@ +headers->get('key'); + $keyDb = $app['db']->getRepository("Entity\ApiKey")->findOneByKey($key); + + if (empty($keyDb)) { + return new Response("User Unauthorized", 401); + } +}; + +$checkUserNotExists = function (Request $request) use ($app) { + + if ($request->getMethod() == "POST") { + $dataJson = json_decode($request->getContent(), true); + $result = $app['db']->getRepository("Entity\User")->findUser($dataJson['login']); + if (!empty($result)) { + return new Response("User exists", 403); + } + } +}; + +$checkUserAutenticate = function (Request $request) use ($app) { + if ($request->getMethod() == "POST") { + $dataJson = json_decode($request->getContent(), true); + $user = $app['db']->getRepository("Entity\User")->findUser($dataJson['login']); + + if (empty($user)) { + return new Response("User not exists", 403); + } + + if (!password_verify($dataJson['password'], $user->getPassword())) { + return new Response("User Unauthorized", 401); + } + } +}; +$userApp->get('/', function (Request $request) use($app) { + $key = $request->headers->get('key'); + $apiKey = $app['db']->getRepository("Entity\ApiKey")->findOneByKey($key); + $user_id = $apiKey->getUser_id(); + $user = $app['db']->getRepository("Entity\User")->findUserById($user_id); + + return $app->json($app['serializer']->serialize($user, 'json'), 200); +}); + + +$userApp->match('/', function (Request $request) use ($app) { + + $dataJson = json_decode($request->getContent(), true); + + $user = new User(); + $user->setLogin($dataJson['login']); + $user->setPassword($dataJson['password']); + + $app['db']->persist($user); + $app['db']->flush(); + + if ($user->getId() > 0) { + return new Response("User created", 200); + } + + return new Response("User invalid", 403); +})->method('POST')->before($checkUserNotExists); + +$userApp->post('/authenticate', function (Request $request) use($app) { + //necessito de luna chave + $dataJson = json_decode($request->getContent(), true); + $user = $app['db']->getRepository("Entity\User")->findUser($dataJson['login']); + + $apiKey = new ApiKey(); + $apiKey->setUser_id($user->getId()); + $app['db']->persist($apiKey); + $app['db']->flush(); + + if ($apiKey->getId() > 0) { + return $app->json(array("key" => $apiKey->getKey()), 201); + } + return new Response("No ", 403); +})->before($checkUserAutenticate); + + +$userApp->put('/', function (Request $request) use ($app) { + $key = $request->headers->get('key'); + $apiKey = $app['db']->getRepository("Entity\ApiKey")->findOneByKey($key); + $user_id = $apiKey->getUser_id(); + $user = $app['db']->getRepository("Entity\User")->findUserById($user_id); + + $dataJson = json_decode($request->getContent(), true); + + if (isset($dataJson['login'])) { + $user->setLogin($dataJson['login']); + } + if (isset($dataJson['password'])) { + $user->setPassword($dataJson['password']); + } + $app['db']->merge($user); + $app['db']->flush(); + + if ($user->getId() > 0) { + return new Response("User updated", 200); + } + return new Response("USer invalid", 403); +})->before($checkUserPermisson); + + +$userApp->delete('/:id', function () { + return 'test'; +}); + + +return $userApp;