diff --git a/bin/docker-entrypoint.sh.d/00-ensure-storage-writable.sh b/bin/docker-entrypoint.sh.d/00-ensure-storage-writable.sh index 1f81f26..d1e4789 100755 --- a/bin/docker-entrypoint.sh.d/00-ensure-storage-writable.sh +++ b/bin/docker-entrypoint.sh.d/00-ensure-storage-writable.sh @@ -2,3 +2,4 @@ mkdir --parents var/cache var/log chown www-data:www-data -R var +chmod a+w -R var diff --git a/composer.json b/composer.json index 64afb04..1f6a4c4 100644 --- a/composer.json +++ b/composer.json @@ -13,6 +13,7 @@ "doctrine/orm": "^3.1", "phpdocumentor/reflection-docblock": "^5.4", "phpstan/phpdoc-parser": "^1.28", + "rekalogika/mapper": "^1.1", "symfony/console": "7.0.*", "symfony/dotenv": "7.0.*", "symfony/flex": "^2", @@ -72,5 +73,8 @@ "allow-contrib": false, "require": "7.0.*" } + }, + "require-dev": { + "symfony/maker-bundle": "^1.58" } } diff --git a/composer.lock b/composer.lock index dfcae1f..6bb8a33 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": "63d5d5c0c7b10c9d6f335cb0b4d10525", + "content-hash": "bd4cd30630c20c75f906c43f8aed6bbc", "packages": [ { "name": "doctrine/cache", @@ -1496,6 +1496,54 @@ }, "time": "2021-02-03T23:26:27+00:00" }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, { "name": "psr/container", "version": "2.0.2", @@ -1649,6 +1697,96 @@ }, "time": "2021-07-14T16:46:02+00:00" }, + { + "name": "rekalogika/mapper", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/rekalogika/mapper.git", + "reference": "6f87e4afb0de0ba752d21061ea5c39ddc52c0dba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rekalogika/mapper/zipball/6f87e4afb0de0ba752d21061ea5c39ddc52c0dba", + "reference": "6f87e4afb0de0ba752d21061ea5c39ddc52c0dba", + "shasum": "" + }, + "require": { + "doctrine/collections": "^2.1", + "php": ">=8.2", + "phpdocumentor/reflection-docblock": "^5.3", + "phpstan/phpdoc-parser": "^1.25", + "psr/container": "^2.0", + "symfony/cache": "^6.4 || ^7.0", + "symfony/clock": "^6.4 || ^7.0", + "symfony/config": "^6.4 || ^7.0", + "symfony/console": "^6.4 || ^7.0", + "symfony/dependency-injection": "^6.4 || ^7.0", + "symfony/property-access": "^6.4 || ^7.0", + "symfony/property-info": "^6.4 || ^7.0", + "symfony/serializer": "^6.4 || ^7.0", + "symfony/service-contracts": "^3.0", + "symfony/var-exporter": "^6.4.1 || ^6.5 || ^7.0.1 || ^7.1" + }, + "require-dev": { + "bnf/phpstan-psr-container": "^1.0", + "brick/money": "^0.9.0", + "dave-liddament/php-language-extensions": "^0.6.0", + "dave-liddament/phpstan-php-language-extensions": "^0.5.0", + "doctrine/doctrine-bundle": "^2.10", + "doctrine/orm": "^2.14 || ^3.0", + "doctrine/persistence": "^3.1", + "ekino/phpstan-banned-code": "^1.0", + "phpstan/phpstan": "^1.10.50", + "phpstan/phpstan-deprecation-rules": "^1.1", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^10.5", + "psalm/plugin-phpunit": "^0.18.4", + "symfony/framework-bundle": "^6.4 || ^7.0", + "symfony/http-kernel": "^6.4 || ^7.0", + "symfony/uid": "^6.4 || ^7.0", + "symfony/var-dumper": "^6.4 || ^7.0", + "symfony/yaml": "^6.4 || ^7.0", + "tomasvotruba/unused-public": "^0.3.5", + "twig/twig": "^2.12|^3.0", + "vimeo/psalm": "^5.18" + }, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Rekalogika\\Mapper\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Priyadi Iman Nurcahyo", + "email": "priyadi@rekalogika.com" + } + ], + "description": "An object mapper for PHP and Symfony. Maps an object to another object. Primarily used for transforming an entity to a DTO and vice versa.", + "homepage": "https://rekalogika.dev/mapper", + "keywords": [ + "api", + "api-platform", + "automapper", + "dto", + "lazy-loading", + "mapper", + "mapping", + "proxy", + "symfony", + "transformation" + ], + "support": { + "issues": "https://github.com/rekalogika/mapper/issues", + "source": "https://github.com/rekalogika/mapper/tree/v1.1.1" + }, + "time": "2024-03-04T04:40:35+00:00" + }, { "name": "symfony/cache", "version": "v7.0.6", @@ -1821,6 +1959,80 @@ ], "time": "2024-01-23T14:51:35+00:00" }, + { + "name": "symfony/clock", + "version": "v7.0.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/clock.git", + "reference": "8b9d08887353d627d5f6c3bf3373b398b49051c2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/clock/zipball/8b9d08887353d627d5f6c3bf3373b398b49051c2", + "reference": "8b9d08887353d627d5f6c3bf3373b398b49051c2", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "psr/clock": "^1.0", + "symfony/polyfill-php83": "^1.28" + }, + "provide": { + "psr/clock-implementation": "1.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/now.php" + ], + "psr-4": { + "Symfony\\Component\\Clock\\": "" + }, + "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": "Decouples applications from the system clock", + "homepage": "https://symfony.com", + "keywords": [ + "clock", + "psr20", + "time" + ], + "support": { + "source": "https://github.com/symfony/clock/tree/v7.0.5" + }, + "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": "2024-03-02T12:46:12+00:00" + }, { "name": "symfony/config", "version": "v7.0.6", @@ -4476,7 +4688,219 @@ "time": "2022-06-03T18:03:27+00:00" } ], - "packages-dev": [], + "packages-dev": [ + { + "name": "nikic/php-parser", + "version": "v5.0.2", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "php": ">=7.4" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" + }, + "time": "2024-03-05T20:51:40+00:00" + }, + { + "name": "symfony/maker-bundle", + "version": "v1.58.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/maker-bundle.git", + "reference": "c4f8d2c5d55950e1a49e822efc83a8511bee8a36" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/c4f8d2c5d55950e1a49e822efc83a8511bee8a36", + "reference": "c4f8d2c5d55950e1a49e822efc83a8511bee8a36", + "shasum": "" + }, + "require": { + "doctrine/inflector": "^2.0", + "nikic/php-parser": "^4.18|^5.0", + "php": ">=8.1", + "symfony/config": "^6.4|^7.0", + "symfony/console": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/deprecation-contracts": "^2.2|^3", + "symfony/filesystem": "^6.4|^7.0", + "symfony/finder": "^6.4|^7.0", + "symfony/framework-bundle": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0" + }, + "conflict": { + "doctrine/doctrine-bundle": "<2.10", + "doctrine/orm": "<2.15" + }, + "require-dev": { + "composer/semver": "^3.0", + "doctrine/doctrine-bundle": "^2.5.0", + "doctrine/orm": "^2.15|^3", + "symfony/http-client": "^6.4|^7.0", + "symfony/phpunit-bridge": "^6.4.1|^7.0", + "symfony/security-core": "^6.4|^7.0", + "symfony/yaml": "^6.4|^7.0", + "twig/twig": "^3.0|^4.x-dev" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bundle\\MakerBundle\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.", + "homepage": "https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html", + "keywords": [ + "code generator", + "dev", + "generator", + "scaffold", + "scaffolding" + ], + "support": { + "issues": "https://github.com/symfony/maker-bundle/issues", + "source": "https://github.com/symfony/maker-bundle/tree/v1.58.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-04-06T15:08:12+00:00" + }, + { + "name": "symfony/process", + "version": "v7.0.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "0e7727191c3b71ebec6d529fa0e50a01ca5679e9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/0e7727191c3b71ebec6d529fa0e50a01ca5679e9", + "reference": "0e7727191c3b71ebec6d529fa0e50a01ca5679e9", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "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": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v7.0.4" + }, + "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": "2024-02-22T20:27:20+00:00" + } + ], "aliases": [], "minimum-stability": "stable", "stability-flags": [], diff --git a/config/bundles.php b/config/bundles.php index c1fa06a..da53a90 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -4,4 +4,6 @@ return [ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], + Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], + Rekalogika\Mapper\RekalogikaMapperBundle::class => ['all' => true], ]; diff --git a/src/Entity/Client.php b/src/Entity/Client.php new file mode 100644 index 0000000..c657ae3 --- /dev/null +++ b/src/Entity/Client.php @@ -0,0 +1,45 @@ +clientId; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(?string $name): void + { + $this->name = $name; + } + + public function getBalance(): ?int + { + return $this->currentBalance; + } +} diff --git a/src/Repository/ClientRepository.php b/src/Repository/ClientRepository.php new file mode 100644 index 0000000..d9d20a0 --- /dev/null +++ b/src/Repository/ClientRepository.php @@ -0,0 +1,48 @@ + + * + * @method Client|null find($id, $lockMode = null, $lockVersion = null) + * @method Client|null findOneBy(array $criteria, array $orderBy = null) + * @method Client[] findAll() + * @method Client[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class ClientRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Client::class); + } + + // /** + // * @return Client[] Returns an array of Client objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('c') + // ->andWhere('c.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('c.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } + + // public function findOneBySomeField($value): ?Client + // { + // return $this->createQueryBuilder('c') + // ->andWhere('c.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +} diff --git a/symfony.lock b/symfony.lock index 872ef19..40d9402 100644 --- a/symfony.lock +++ b/symfony.lock @@ -26,6 +26,9 @@ "migrations/.gitignore" ] }, + "rekalogika/mapper": { + "version": "v1.1.1" + }, "symfony/console": { "version": "7.0", "recipe": { @@ -69,6 +72,15 @@ "src/Kernel.php" ] }, + "symfony/maker-bundle": { + "version": "1.58", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "1.0", + "ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f" + } + }, "symfony/routing": { "version": "7.0", "recipe": {