diff --git a/config/bundles.php b/config/bundles.php index cb0b7fc..792a756 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -1,12 +1,37 @@ - ['all' => true], - Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], - Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], - Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], - Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], - Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], - Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], - ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], + FrameworkBundle::class => [ + 'all' => true, + ], + MakerBundle::class => [ + 'dev' => true, + ], + DoctrineBundle::class => [ + 'all' => true, + ], + DoctrineMigrationsBundle::class => [ + 'all' => true, + ], + TwigBundle::class => [ + 'all' => true, + ], + SecurityBundle::class => [ + 'all' => true, + ], + NelmioCorsBundle::class => [ + 'all' => true, + ], + ApiPlatformBundle::class => [ + 'all' => true, + ], ]; diff --git a/config/packages/api_platform.php b/config/packages/api_platform.php index 516f73b..d19bc6e 100644 --- a/config/packages/api_platform.php +++ b/config/packages/api_platform.php @@ -1,6 +1,4 @@ -count(); - if($count < $page * $itemsPerPage) { + if ($count < $page * $itemsPerPage) { $nextPage = $page; } diff --git a/src/Entity/FoodOrder.php b/src/Entity/FoodOrder.php index d278474..9a86e15 100644 --- a/src/Entity/FoodOrder.php +++ b/src/Entity/FoodOrder.php @@ -3,8 +3,6 @@ namespace App\Entity; use ApiPlatform\Metadata\ApiResource; -use ApiPlatform\Metadata\Get; -use ApiPlatform\Metadata\GetCollection; use App\Repository\FoodOrderRepository; use DateInterval; use DateTimeImmutable; diff --git a/src/Entity/FoodVendor.php b/src/Entity/FoodVendor.php index eea8826..5b2aae3 100644 --- a/src/Entity/FoodVendor.php +++ b/src/Entity/FoodVendor.php @@ -3,8 +3,6 @@ namespace App\Entity; use ApiPlatform\Metadata\ApiResource; -use ApiPlatform\Metadata\Get; -use ApiPlatform\Metadata\GetCollection; use App\Repository\FoodVendorRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -38,13 +36,17 @@ class FoodVendor #[ORM\Column(length: 255, nullable: true)] private string|null $menuLink = null; + #[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( - #[ORM\Id] - #[ORM\GeneratedValue(strategy: 'CUSTOM')] - #[ORM\Column(type: UlidType::NAME, unique: true)] - #[ORM\CustomIdGenerator(class: UlidGenerator::class)] - private Ulid|null $id = new Ulid ) { + if (! $this->id instanceof Ulid) { + $this->id = new Ulid; + } $this->foodOrders = new ArrayCollection; $this->menuItems = new ArrayCollection; } diff --git a/src/Entity/MenuItem.php b/src/Entity/MenuItem.php index fe301ef..f4f4ef6 100644 --- a/src/Entity/MenuItem.php +++ b/src/Entity/MenuItem.php @@ -3,8 +3,6 @@ namespace App\Entity; use ApiPlatform\Metadata\ApiResource; -use ApiPlatform\Metadata\Get; -use ApiPlatform\Metadata\GetCollection; use App\Repository\MenuItemRepository; use DateTimeImmutable; use Doctrine\ORM\Mapping as ORM; diff --git a/src/Entity/OrderItem.php b/src/Entity/OrderItem.php index 84300fa..9421312 100644 --- a/src/Entity/OrderItem.php +++ b/src/Entity/OrderItem.php @@ -3,8 +3,6 @@ namespace App\Entity; use ApiPlatform\Metadata\ApiResource; -use ApiPlatform\Metadata\Get; -use ApiPlatform\Metadata\GetCollection; use App\Repository\OrderItemRepository; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator;