Compare commits
No commits in common. "apiapiapiapiapi" and "main" have entirely different histories.
apiapiapia
...
main
17 changed files with 383 additions and 2707 deletions
4
.env
4
.env
|
@ -28,7 +28,3 @@ DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
|
|||
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
|
||||
# DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8"
|
||||
###< doctrine/doctrine-bundle ###
|
||||
|
||||
###> nelmio/cors-bundle ###
|
||||
CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
|
||||
###< nelmio/cors-bundle ###
|
||||
|
|
|
@ -7,29 +7,18 @@
|
|||
"php": ">=8.3",
|
||||
"ext-ctype": "*",
|
||||
"ext-iconv": "*",
|
||||
"api-platform/doctrine-orm": "^4.0",
|
||||
"api-platform/symfony": "^4.0",
|
||||
"doctrine/dbal": "^4.1",
|
||||
"doctrine/doctrine-bundle": "^2.12",
|
||||
"doctrine/doctrine-migrations-bundle": "^3.3.1",
|
||||
"doctrine/orm": "^3.2.1",
|
||||
"nelmio/cors-bundle": "^2.5",
|
||||
"phpdocumentor/reflection-docblock": "^5.4",
|
||||
"phpstan/phpdoc-parser": "^1.30",
|
||||
"psr/clock": "^1.0",
|
||||
"symfony/asset": "7.1.*",
|
||||
"symfony/console": "7.1.*",
|
||||
"symfony/dotenv": "7.1.*",
|
||||
"symfony/expression-language": "7.1.*",
|
||||
"symfony/flex": "^2.4.6",
|
||||
"symfony/form": "7.1.*",
|
||||
"symfony/framework-bundle": "7.1.*",
|
||||
"symfony/property-access": "7.1.*",
|
||||
"symfony/property-info": "7.1.*",
|
||||
"symfony/runtime": "7.1.*",
|
||||
"symfony/security-bundle": "7.1.*",
|
||||
"symfony/security-csrf": "7.1.*",
|
||||
"symfony/serializer": "7.1.*",
|
||||
"symfony/twig-bundle": "7.1.*",
|
||||
"symfony/uid": "7.1.*",
|
||||
"symfony/validator": "7.1.*",
|
||||
|
|
2882
composer.lock
generated
2882
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,12 +1,9 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
use ApiPlatform\Symfony\Bundle\ApiPlatformBundle;
|
||||
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
|
||||
use Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle;
|
||||
use Nelmio\CorsBundle\NelmioCorsBundle;
|
||||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
||||
use Symfony\Bundle\MakerBundle\MakerBundle;
|
||||
use Symfony\Bundle\SecurityBundle\SecurityBundle;
|
||||
use Symfony\Bundle\TwigBundle\TwigBundle;
|
||||
|
||||
return [
|
||||
|
@ -25,13 +22,4 @@ return [
|
|||
TwigBundle::class => [
|
||||
'all' => true,
|
||||
],
|
||||
SecurityBundle::class => [
|
||||
'all' => true,
|
||||
],
|
||||
NelmioCorsBundle::class => [
|
||||
'all' => true,
|
||||
],
|
||||
ApiPlatformBundle::class => [
|
||||
'all' => true,
|
||||
],
|
||||
];
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
<?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',
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
};
|
|
@ -1,33 +0,0 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->extension('nelmio_cors', [
|
||||
'defaults' => [
|
||||
'origin_regex' => true,
|
||||
'allow_origin' => [
|
||||
'%env(CORS_ALLOW_ORIGIN)%',
|
||||
],
|
||||
'allow_methods' => [
|
||||
'GET',
|
||||
'OPTIONS',
|
||||
'POST',
|
||||
'PUT',
|
||||
'PATCH',
|
||||
'DELETE',
|
||||
],
|
||||
'allow_headers' => [
|
||||
'Content-Type',
|
||||
'Authorization',
|
||||
],
|
||||
'expose_headers' => [
|
||||
'Link',
|
||||
],
|
||||
'max_age' => 3600,
|
||||
],
|
||||
'paths' => [
|
||||
'^/' => null,
|
||||
],
|
||||
]);
|
||||
};
|
|
@ -1,40 +0,0 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->extension('security', [
|
||||
'password_hashers' => [
|
||||
PasswordAuthenticatedUserInterface::class => 'auto',
|
||||
],
|
||||
'providers' => [
|
||||
'users_in_memory' => [
|
||||
'memory' => null,
|
||||
],
|
||||
],
|
||||
'firewalls' => [
|
||||
'dev' => [
|
||||
'pattern' => '^/(_(profiler|wdt)|css|images|js)/',
|
||||
'security' => false,
|
||||
],
|
||||
'main' => [
|
||||
'lazy' => true,
|
||||
'provider' => 'users_in_memory',
|
||||
],
|
||||
],
|
||||
'access_control' => null,
|
||||
]);
|
||||
if ($containerConfigurator->env() === 'test') {
|
||||
$containerConfigurator->extension('security', [
|
||||
'password_hashers' => [
|
||||
PasswordAuthenticatedUserInterface::class => [
|
||||
'algorithm' => 'auto',
|
||||
'cost' => 4,
|
||||
'time_cost' => 3,
|
||||
'memory_cost' => 10,
|
||||
],
|
||||
],
|
||||
]);
|
||||
}
|
||||
};
|
|
@ -1,8 +0,0 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
|
||||
|
||||
return static function (RoutingConfigurator $routingConfigurator): void {
|
||||
$routingConfigurator->import('.', 'api_platform')
|
||||
->prefix('/api');
|
||||
};
|
|
@ -1,7 +0,0 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
|
||||
|
||||
return static function (RoutingConfigurator $routingConfigurator): void {
|
||||
$routingConfigurator->import('security.route_loader.logout', 'service');
|
||||
};
|
|
@ -14,9 +14,7 @@
|
|||
"@default": true,
|
||||
"global-ignore": [
|
||||
"App\\Service\\Favicon::__toString",
|
||||
],
|
||||
"global-ignoreSourceCodeByRegex": [
|
||||
"#\\[ORM\\\\Column.*"
|
||||
"ORM\\Column.*"
|
||||
]
|
||||
}
|
||||
}
|
0
src/ApiResource/.gitignore
vendored
0
src/ApiResource/.gitignore
vendored
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use App\Repository\FoodOrderRepository;
|
||||
use DateInterval;
|
||||
use DateTimeImmutable;
|
||||
|
@ -15,8 +14,6 @@ use Symfony\Component\Uid\Ulid;
|
|||
use function iterator_to_array;
|
||||
|
||||
#[ORM\Entity(repositoryClass: FoodOrderRepository::class)]
|
||||
#[ApiResource(
|
||||
)]
|
||||
class FoodOrder
|
||||
{
|
||||
#[ORM\Column(nullable: true)]
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use App\Repository\FoodVendorRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
@ -10,15 +9,11 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator;
|
||||
use Symfony\Bridge\Doctrine\Types\UlidType;
|
||||
use Symfony\Component\Uid\Ulid;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
|
||||
#[ORM\Entity(repositoryClass: FoodVendorRepository::class)]
|
||||
#[ApiResource(
|
||||
)]
|
||||
class FoodVendor
|
||||
{
|
||||
#[ORM\Column(length: 50)]
|
||||
#[NotBlank]
|
||||
private string|null $name = null;
|
||||
|
||||
/**
|
||||
|
@ -36,17 +31,13 @@ class FoodVendor
|
|||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private string|null $menuLink = null;
|
||||
|
||||
public function __construct(
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
|
||||
#[ORM\Column(type: UlidType::NAME, unique: true)]
|
||||
#[ORM\CustomIdGenerator(class: UlidGenerator::class)]
|
||||
private Ulid|null $id = null;
|
||||
|
||||
public function __construct(
|
||||
private Ulid|null $id = new Ulid
|
||||
) {
|
||||
if (! $this->id instanceof Ulid) {
|
||||
$this->id = new Ulid;
|
||||
}
|
||||
$this->foodOrders = new ArrayCollection;
|
||||
$this->menuItems = new ArrayCollection;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use App\Repository\MenuItemRepository;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
@ -11,8 +10,6 @@ use Symfony\Bridge\Doctrine\Types\UlidType;
|
|||
use Symfony\Component\Uid\Ulid;
|
||||
|
||||
#[ORM\Entity(repositoryClass: MenuItemRepository::class)]
|
||||
#[ApiResource(
|
||||
)]
|
||||
class MenuItem
|
||||
{
|
||||
#[ORM\Column(length: 255)]
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use App\Repository\OrderItemRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator;
|
||||
|
@ -10,8 +9,6 @@ use Symfony\Bridge\Doctrine\Types\UlidType;
|
|||
use Symfony\Component\Uid\Ulid;
|
||||
|
||||
#[ORM\Entity(repositoryClass: OrderItemRepository::class)]
|
||||
#[ApiResource(
|
||||
)]
|
||||
class OrderItem
|
||||
{
|
||||
#[ORM\Id]
|
||||
|
|
39
symfony.lock
39
symfony.lock
|
@ -1,18 +1,4 @@
|
|||
{
|
||||
"api-platform/symfony": {
|
||||
"version": "4.0",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "4.0",
|
||||
"ref": "e9952e9f393c2d048f10a78f272cd35e807d972b"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/api_platform.yaml",
|
||||
"config/routes/api_platform.yaml",
|
||||
"src/ApiResource/.gitignore"
|
||||
]
|
||||
},
|
||||
"doctrine/doctrine-bundle": {
|
||||
"version": "2.12",
|
||||
"recipe": {
|
||||
|
@ -40,18 +26,6 @@
|
|||
"migrations/.gitignore"
|
||||
]
|
||||
},
|
||||
"nelmio/cors-bundle": {
|
||||
"version": "2.5",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "1.5",
|
||||
"ref": "6bea22e6c564fba3a1391615cada1437d0bde39c"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/nelmio_cors.yaml"
|
||||
]
|
||||
},
|
||||
"phpstan/phpstan": {
|
||||
"version": "1.11",
|
||||
"recipe": {
|
||||
|
@ -164,19 +138,6 @@
|
|||
"config/routes.yaml"
|
||||
]
|
||||
},
|
||||
"symfony/security-bundle": {
|
||||
"version": "7.1",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "6.4",
|
||||
"ref": "2ae08430db28c8eb4476605894296c82a642028f"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/security.yaml",
|
||||
"config/routes/security.yaml"
|
||||
]
|
||||
},
|
||||
"symfony/twig-bundle": {
|
||||
"version": "7.1",
|
||||
"recipe": {
|
||||
|
|
Loading…
Reference in a new issue