forked from lubiana/futtern
api api
This commit is contained in:
parent
9d2f0204e3
commit
ee32852789
12 changed files with 514 additions and 3 deletions
|
@ -7,6 +7,8 @@
|
|||
"php": ">=8.4",
|
||||
"ext-ctype": "*",
|
||||
"ext-iconv": "*",
|
||||
"api-platform/doctrine-orm": "*",
|
||||
"api-platform/symfony": "*",
|
||||
"doctrine/dbal": "^4.2.3",
|
||||
"doctrine/doctrine-bundle": "^2.14.1",
|
||||
"doctrine/doctrine-migrations-bundle": "^3.4.2",
|
||||
|
|
417
composer.lock
generated
417
composer.lock
generated
|
@ -4,8 +4,224 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "960c510bab4f3f719a8433b77b0e6e47",
|
||||
"content-hash": "c21233664fb5c4d25afb8a8cdc29213a",
|
||||
"packages": [
|
||||
{
|
||||
"name": "api-platform/core",
|
||||
"version": "v4.1.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/api-platform/core.git",
|
||||
"reference": "64ff50f9b7206e7ac324ea221537f753194889b3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/api-platform/core/zipball/64ff50f9b7206e7ac324ea221537f753194889b3",
|
||||
"reference": "64ff50f9b7206e7ac324ea221537f753194889b3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/inflector": "^2.0",
|
||||
"php": ">=8.2",
|
||||
"psr/cache": "^1.0 || ^2.0 || ^3.0",
|
||||
"psr/container": "^1.0 || ^2.0",
|
||||
"symfony/deprecation-contracts": "^3.1",
|
||||
"symfony/http-foundation": "^6.4 || ^7.0",
|
||||
"symfony/http-kernel": "^6.4 || ^7.0",
|
||||
"symfony/property-access": "^6.4 || ^7.0",
|
||||
"symfony/property-info": "^6.4 || ^7.1",
|
||||
"symfony/serializer": "^6.4 || ^7.0",
|
||||
"symfony/translation-contracts": "^3.3",
|
||||
"symfony/type-info": "^7.2",
|
||||
"symfony/web-link": "^6.4 || ^7.1",
|
||||
"willdurand/negotiation": "^3.1"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/common": "<3.2.2",
|
||||
"doctrine/dbal": "<2.10",
|
||||
"doctrine/mongodb-odm": "<2.4",
|
||||
"doctrine/orm": "<2.14.0",
|
||||
"doctrine/persistence": "<1.3",
|
||||
"phpspec/prophecy": "<1.15",
|
||||
"phpunit/phpunit": "<9.5",
|
||||
"symfony/framework-bundle": "6.4.6 || 7.0.6",
|
||||
"symfony/var-exporter": "<6.1.1"
|
||||
},
|
||||
"replace": {
|
||||
"api-platform/doctrine-common": "self.version",
|
||||
"api-platform/doctrine-odm": "self.version",
|
||||
"api-platform/doctrine-orm": "self.version",
|
||||
"api-platform/documentation": "self.version",
|
||||
"api-platform/elasticsearch": "self.version",
|
||||
"api-platform/graphql": "self.version",
|
||||
"api-platform/http-cache": "self.version",
|
||||
"api-platform/hydra": "self.version",
|
||||
"api-platform/json-api": "self.version",
|
||||
"api-platform/json-hal": "self.version",
|
||||
"api-platform/json-schema": "self.version",
|
||||
"api-platform/jsonld": "self.version",
|
||||
"api-platform/laravel": "self.version",
|
||||
"api-platform/metadata": "self.version",
|
||||
"api-platform/openapi": "self.version",
|
||||
"api-platform/parameter-validator": "self.version",
|
||||
"api-platform/ramsey-uuid": "self.version",
|
||||
"api-platform/serializer": "self.version",
|
||||
"api-platform/state": "self.version",
|
||||
"api-platform/symfony": "self.version",
|
||||
"api-platform/validator": "self.version"
|
||||
},
|
||||
"require-dev": {
|
||||
"behat/behat": "^3.11",
|
||||
"behat/mink": "^1.9",
|
||||
"doctrine/cache": "^1.11 || ^2.1",
|
||||
"doctrine/common": "^3.2.2",
|
||||
"doctrine/dbal": "^4.0",
|
||||
"doctrine/doctrine-bundle": "^2.11",
|
||||
"doctrine/mongodb-odm": "^2.10",
|
||||
"doctrine/mongodb-odm-bundle": "^5.0",
|
||||
"doctrine/orm": "^2.17 || ^3.0",
|
||||
"elasticsearch/elasticsearch": "^7.17 || ^8.4 || ^9.0",
|
||||
"friends-of-behat/mink-browserkit-driver": "^1.3.1",
|
||||
"friends-of-behat/mink-extension": "^2.2",
|
||||
"friends-of-behat/symfony-extension": "^2.1",
|
||||
"guzzlehttp/guzzle": "^6.0 || ^7.0",
|
||||
"illuminate/config": "^11.0 || ^12.0",
|
||||
"illuminate/contracts": "^11.0 || ^12.0",
|
||||
"illuminate/database": "^11.0 || ^12.0",
|
||||
"illuminate/http": "^11.0 || ^12.0",
|
||||
"illuminate/pagination": "^11.0 || ^12.0",
|
||||
"illuminate/routing": "^11.0 || ^12.0",
|
||||
"illuminate/support": "^11.0 || ^12.0",
|
||||
"jangregor/phpstan-prophecy": "^1.0",
|
||||
"justinrainbow/json-schema": "^5.2.11",
|
||||
"laravel/framework": "^11.0 || ^12.0",
|
||||
"orchestra/testbench": "^9.1",
|
||||
"phpspec/prophecy-phpunit": "^2.2",
|
||||
"phpstan/extension-installer": "^1.1",
|
||||
"phpstan/phpdoc-parser": "^1.29 || ^2.0",
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"phpstan/phpstan-doctrine": "^1.0",
|
||||
"phpstan/phpstan-phpunit": "^1.0",
|
||||
"phpstan/phpstan-symfony": "^1.0",
|
||||
"phpunit/phpunit": "11.5.x-dev",
|
||||
"psr/log": "^1.0 || ^2.0 || ^3.0",
|
||||
"ramsey/uuid": "^4.7",
|
||||
"ramsey/uuid-doctrine": "^2.0",
|
||||
"soyuka/contexts": "^3.3.10",
|
||||
"soyuka/pmu": "^0.2.0",
|
||||
"soyuka/stubs-mongodb": "^1.0",
|
||||
"symfony/asset": "^6.4 || ^7.0",
|
||||
"symfony/browser-kit": "^6.4 || ^7.0",
|
||||
"symfony/cache": "^6.4 || ^7.0",
|
||||
"symfony/config": "^6.4 || ^7.0",
|
||||
"symfony/console": "^6.4 || ^7.0",
|
||||
"symfony/css-selector": "^6.4 || ^7.0",
|
||||
"symfony/dependency-injection": "^6.4 || ^7.0",
|
||||
"symfony/doctrine-bridge": "^6.4.2 || ^7.0.2",
|
||||
"symfony/dom-crawler": "^6.4 || ^7.0",
|
||||
"symfony/error-handler": "^6.4 || ^7.0",
|
||||
"symfony/event-dispatcher": "^6.4 || ^7.0",
|
||||
"symfony/expression-language": "^6.4 || ^7.0",
|
||||
"symfony/finder": "^6.4 || ^7.0",
|
||||
"symfony/form": "^6.4 || ^7.0",
|
||||
"symfony/framework-bundle": "^6.4 || ^7.0",
|
||||
"symfony/http-client": "^6.4 || ^7.0",
|
||||
"symfony/intl": "^6.4 || ^7.0",
|
||||
"symfony/maker-bundle": "^1.24",
|
||||
"symfony/mercure-bundle": "*",
|
||||
"symfony/messenger": "^6.4 || ^7.0",
|
||||
"symfony/routing": "^6.4 || ^7.0",
|
||||
"symfony/security-bundle": "^6.4 || ^7.0",
|
||||
"symfony/security-core": "^6.4 || ^7.0",
|
||||
"symfony/stopwatch": "^6.4 || ^7.0",
|
||||
"symfony/string": "^6.4 || ^7.0",
|
||||
"symfony/twig-bundle": "^6.4 || ^7.0",
|
||||
"symfony/uid": "^6.4 || ^7.0",
|
||||
"symfony/validator": "^6.4 || ^7.0",
|
||||
"symfony/web-profiler-bundle": "^6.4 || ^7.0",
|
||||
"symfony/yaml": "^6.4 || ^7.0",
|
||||
"twig/twig": "^1.42.3 || ^2.12 || ^3.0",
|
||||
"webonyx/graphql-php": "^15.0"
|
||||
},
|
||||
"suggest": {
|
||||
"doctrine/mongodb-odm-bundle": "To support MongoDB. Only versions 4.0 and later are supported.",
|
||||
"elasticsearch/elasticsearch": "To support Elasticsearch.",
|
||||
"ocramius/package-versions": "To display the API Platform's version in the debug bar.",
|
||||
"phpstan/phpdoc-parser": "To support extracting metadata from PHPDoc.",
|
||||
"psr/cache-implementation": "To use metadata caching.",
|
||||
"ramsey/uuid": "To support Ramsey's UUID identifiers.",
|
||||
"symfony/cache": "To have metadata caching when using Symfony integration.",
|
||||
"symfony/config": "To load XML configuration files.",
|
||||
"symfony/expression-language": "To use authorization features.",
|
||||
"symfony/http-client": "To use the HTTP cache invalidation system.",
|
||||
"symfony/messenger": "To support messenger integration.",
|
||||
"symfony/security": "To use authorization features.",
|
||||
"symfony/twig-bundle": "To use the Swagger UI integration.",
|
||||
"symfony/uid": "To support Symfony UUID/ULID identifiers.",
|
||||
"symfony/web-profiler-bundle": "To use the data collector.",
|
||||
"webonyx/graphql-php": "To support GraphQL."
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"pmu": {
|
||||
"projects": [
|
||||
"./src/*/composer.json",
|
||||
"src/Doctrine/*/composer.json"
|
||||
]
|
||||
},
|
||||
"thanks": {
|
||||
"url": "https://github.com/api-platform/api-platform",
|
||||
"name": "api-platform/api-platform"
|
||||
},
|
||||
"symfony": {
|
||||
"require": "^6.4 || ^7.1"
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-3.4": "3.4.x-dev",
|
||||
"dev-4.1": "4.1.x-dev",
|
||||
"dev-main": "4.2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/JsonLd/HydraContext.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"ApiPlatform\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kévin Dunglas",
|
||||
"email": "kevin@dunglas.fr",
|
||||
"homepage": "https://dunglas.fr"
|
||||
}
|
||||
],
|
||||
"description": "Build a fully-featured hypermedia or GraphQL API in minutes!",
|
||||
"homepage": "https://api-platform.com",
|
||||
"keywords": [
|
||||
"Hydra",
|
||||
"JSON-LD",
|
||||
"api",
|
||||
"graphql",
|
||||
"hal",
|
||||
"jsonapi",
|
||||
"laravel",
|
||||
"openapi",
|
||||
"rest",
|
||||
"swagger",
|
||||
"symfony"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/api-platform/core/issues",
|
||||
"source": "https://github.com/api-platform/core/tree/v4.1.16"
|
||||
},
|
||||
"time": "2025-06-13T13:00:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/collections",
|
||||
"version": "2.3.0",
|
||||
|
@ -1609,6 +1825,62 @@
|
|||
},
|
||||
"time": "2019-01-08T18:20:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/link",
|
||||
"version": "2.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/link.git",
|
||||
"reference": "84b159194ecfd7eaa472280213976e96415433f7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/link/zipball/84b159194ecfd7eaa472280213976e96415433f7",
|
||||
"reference": "84b159194ecfd7eaa472280213976e96415433f7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.0.0"
|
||||
},
|
||||
"suggest": {
|
||||
"fig/link-util": "Provides some useful PSR-13 utilities"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Link\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interfaces for HTTP links",
|
||||
"homepage": "https://github.com/php-fig/link",
|
||||
"keywords": [
|
||||
"http",
|
||||
"http-link",
|
||||
"link",
|
||||
"psr",
|
||||
"psr-13",
|
||||
"rest"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/php-fig/link/tree/2.0.1"
|
||||
},
|
||||
"time": "2021-03-11T23:00:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "3.0.2",
|
||||
|
@ -5644,6 +5916,89 @@
|
|||
],
|
||||
"time": "2025-05-15T09:04:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/web-link",
|
||||
"version": "v7.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/web-link.git",
|
||||
"reference": "7697f74fce67555665339423ce453cc8216a98ff"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/web-link/zipball/7697f74fce67555665339423ce453cc8216a98ff",
|
||||
"reference": "7697f74fce67555665339423ce453cc8216a98ff",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"psr/link": "^1.1|^2.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/http-kernel": "<6.4"
|
||||
},
|
||||
"provide": {
|
||||
"psr/link-implementation": "1.0|2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/http-kernel": "^6.4|^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\WebLink\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kévin Dunglas",
|
||||
"email": "dunglas@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Manages links between resources",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"dns-prefetch",
|
||||
"http",
|
||||
"http2",
|
||||
"link",
|
||||
"performance",
|
||||
"prefetch",
|
||||
"preload",
|
||||
"prerender",
|
||||
"psr13",
|
||||
"push"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/web-link/tree/v7.3.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": "2025-05-19T13:28:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v7.3.0",
|
||||
|
@ -5852,6 +6207,62 @@
|
|||
"source": "https://github.com/webmozarts/assert/tree/1.11.0"
|
||||
},
|
||||
"time": "2022-06-03T18:03:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "willdurand/negotiation",
|
||||
"version": "3.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/willdurand/Negotiation.git",
|
||||
"reference": "68e9ea0553ef6e2ee8db5c1d98829f111e623ec2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/willdurand/Negotiation/zipball/68e9ea0553ef6e2ee8db5c1d98829f111e623ec2",
|
||||
"reference": "68e9ea0553ef6e2ee8db5c1d98829f111e623ec2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/phpunit-bridge": "^5.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Negotiation\\": "src/Negotiation"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "William Durand",
|
||||
"email": "will+git@drnd.me"
|
||||
}
|
||||
],
|
||||
"description": "Content Negotiation tools for PHP provided as a standalone library.",
|
||||
"homepage": "http://williamdurand.fr/Negotiation/",
|
||||
"keywords": [
|
||||
"accept",
|
||||
"content",
|
||||
"format",
|
||||
"header",
|
||||
"negotiation"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/willdurand/Negotiation/issues",
|
||||
"source": "https://github.com/willdurand/Negotiation/tree/3.1.0"
|
||||
},
|
||||
"time": "2022-01-30T20:08:53+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
|
@ -9873,7 +10284,7 @@
|
|||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": {},
|
||||
"stability-flags": [],
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
|
@ -9881,7 +10292,7 @@
|
|||
"ext-ctype": "*",
|
||||
"ext-iconv": "*"
|
||||
},
|
||||
"platform-dev": {},
|
||||
"platform-dev": [],
|
||||
"platform-overrides": {
|
||||
"php": "8.4"
|
||||
},
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
use ApiPlatform\Symfony\Bundle\ApiPlatformBundle;
|
||||
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
|
||||
use Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle;
|
||||
use Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle;
|
||||
|
@ -45,4 +46,7 @@ return [
|
|||
'dev' => true,
|
||||
'test' => true,
|
||||
],
|
||||
ApiPlatformBundle::class => [
|
||||
'all' => true,
|
||||
],
|
||||
];
|
||||
|
|
20
config/packages/api_platform.php
Normal file
20
config/packages/api_platform.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->extension('api_platform', [
|
||||
'title' => 'Hello API Platform',
|
||||
'version' => '1.0.0',
|
||||
'defaults' => [
|
||||
'stateless' => true,
|
||||
'cache_headers' => [
|
||||
'vary' => [
|
||||
'Content-Type',
|
||||
'Authorization',
|
||||
'Origin',
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
};
|
8
config/routes/api_platform.php
Normal file
8
config/routes/api_platform.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
|
||||
|
||||
return static function (RoutingConfigurator $routingConfigurator): void {
|
||||
$routingConfigurator->import('.', 'api_platform')
|
||||
->prefix('/api');
|
||||
};
|
0
src/ApiResource/.gitignore
vendored
Normal file
0
src/ApiResource/.gitignore
vendored
Normal file
|
@ -2,7 +2,14 @@
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Delete;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use ApiPlatform\Metadata\GetCollection;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use ApiPlatform\Metadata\Put;
|
||||
use App\Repository\FoodOrderRepository;
|
||||
use App\State\OpenOrdersProvider;
|
||||
use DateInterval;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
@ -13,6 +20,20 @@ use Symfony\Component\Uid\Ulid;
|
|||
|
||||
use function iterator_to_array;
|
||||
|
||||
#[ApiResource(
|
||||
operations: [
|
||||
new GetCollection(
|
||||
uriTemplate: 'food_orders/open',
|
||||
description: 'Get only open orders',
|
||||
provider: OpenOrdersProvider::class,
|
||||
),
|
||||
new GetCollection,
|
||||
new Get,
|
||||
new Post,
|
||||
new Put,
|
||||
new Delete,
|
||||
]
|
||||
)]
|
||||
#[ORM\Entity(repositoryClass: FoodOrderRepository::class)]
|
||||
class FoodOrder
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use App\Repository\FoodVendorRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
@ -11,6 +12,7 @@ use Symfony\Bridge\Doctrine\Types\UlidType;
|
|||
use Symfony\Component\Uid\Ulid;
|
||||
|
||||
#[ORM\Entity(repositoryClass: FoodVendorRepository::class)]
|
||||
#[ApiResource]
|
||||
class FoodVendor
|
||||
{
|
||||
#[ORM\Column(length: 50)]
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use App\Repository\MenuItemRepository;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
@ -11,6 +12,7 @@ use Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator;
|
|||
use Symfony\Bridge\Doctrine\Types\UlidType;
|
||||
use Symfony\Component\Uid\Ulid;
|
||||
|
||||
#[ApiResource]
|
||||
#[ORM\Entity(repositoryClass: MenuItemRepository::class)]
|
||||
class MenuItem
|
||||
{
|
||||
|
|
|
@ -2,12 +2,14 @@
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use App\Repository\OrderItemRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator;
|
||||
use Symfony\Bridge\Doctrine\Types\UlidType;
|
||||
use Symfony\Component\Uid\Ulid;
|
||||
|
||||
#[ApiResource]
|
||||
#[ORM\Entity(repositoryClass: OrderItemRepository::class)]
|
||||
class OrderItem
|
||||
{
|
||||
|
|
25
src/State/OpenOrdersProvider.php
Normal file
25
src/State/OpenOrdersProvider.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\State;
|
||||
|
||||
use ApiPlatform\Metadata\Operation;
|
||||
use ApiPlatform\State\ProviderInterface;
|
||||
use App\Entity\FoodOrder;
|
||||
use App\Repository\FoodOrderRepository;
|
||||
use Override;
|
||||
|
||||
final readonly class OpenOrdersProvider implements ProviderInterface
|
||||
{
|
||||
public function __construct(
|
||||
private FoodOrderRepository $repository
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @return FoodOrder[]
|
||||
*/
|
||||
#[Override]
|
||||
public function provide(Operation $operation, array $uriVariables = [], array $context = []): array
|
||||
{
|
||||
return $this->repository->findOpenOrders();
|
||||
}
|
||||
}
|
14
symfony.lock
14
symfony.lock
|
@ -1,4 +1,18 @@
|
|||
{
|
||||
"api-platform/core": {
|
||||
"version": "4.1",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "4.0",
|
||||
"ref": "cb9e6b8ceb9b62f32d41fc8ad72a25d5bd674c6d"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/api_platform.yaml",
|
||||
"config/routes/api_platform.yaml",
|
||||
"src/ApiResource/.gitignore"
|
||||
]
|
||||
},
|
||||
"doctrine/deprecations": {
|
||||
"version": "1.1",
|
||||
"recipe": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue