New API - RoomCategory

This commit is contained in:
2024-04-22 18:10:16 +02:00
parent 2079188760
commit fcfe2f9250
12 changed files with 1085 additions and 3 deletions
+1 -1
View File
@@ -26,5 +26,5 @@ APP_SECRET=d130654a5d6a8ab5945b20b22dfeee74
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=16&charset=utf8"
DATABASE_URL="postgresql://app:[email protected]:51223/app?serverVersion=16&charset=utf8"
###< doctrine/doctrine-bundle ###
+1 -1
View File
@@ -10,7 +10,7 @@ services:
- ./frankenphp/conf.d/app.dev.ini:/usr/local/etc/php/conf.d/app.dev.ini:ro
# If you develop on Mac or Windows you can remove the vendor/ directory
# from the bind-mount for better performance by enabling the next line:
#- /app/vendor
- /app/vendor
environment:
MERCURE_EXTRA_DIRECTIVES: demo
# See https://xdebug.org/docs/all_settings#mode
+5
View File
@@ -13,12 +13,17 @@
"doctrine/doctrine-bundle": "^2.12",
"doctrine/doctrine-migrations-bundle": "^3.3",
"doctrine/orm": "^3.1",
"phpdocumentor/reflection-docblock": "^5.4",
"phpstan/phpdoc-parser": "^1.28",
"runtime/frankenphp-symfony": "^0.2.0",
"symfony/console": "7.0.*",
"symfony/dotenv": "7.0.*",
"symfony/flex": "^2",
"symfony/framework-bundle": "7.0.*",
"symfony/property-access": "7.0.*",
"symfony/property-info": "7.0.*",
"symfony/runtime": "7.0.*",
"symfony/serializer": "7.0.*",
"symfony/yaml": "7.0.*"
},
"config": {
Generated
+535 -1
View File
@@ -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": "c3293f72113c6421eff9352de9d94b87",
"content-hash": "6c252fc3f71b250512198fdafcb120c2",
"packages": [
{
"name": "doctrine/cache",
@@ -1225,6 +1225,228 @@
},
"time": "2023-08-16T21:49:04+00:00"
},
{
"name": "phpdocumentor/reflection-common",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b",
"reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-2.x": "2.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jaap van Otterdijk",
"email": "[email protected]"
}
],
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
"homepage": "http://www.phpdoc.org",
"keywords": [
"FQSEN",
"phpDocumentor",
"phpdoc",
"reflection",
"static analysis"
],
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
"source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x"
},
"time": "2020-06-27T09:03:43+00:00"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "5.4.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "298d2febfe79d03fe714eb871d5538da55205b1a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/298d2febfe79d03fe714eb871d5538da55205b1a",
"reference": "298d2febfe79d03fe714eb871d5538da55205b1a",
"shasum": ""
},
"require": {
"doctrine/deprecations": "^1.1",
"ext-filter": "*",
"php": "^7.4 || ^8.0",
"phpdocumentor/reflection-common": "^2.2",
"phpdocumentor/type-resolver": "^1.7",
"phpstan/phpdoc-parser": "^1.7",
"webmozart/assert": "^1.9.1"
},
"require-dev": {
"mockery/mockery": "~1.3.5",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-mockery": "^1.1",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpunit/phpunit": "^9.5",
"vimeo/psalm": "^5.13"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "[email protected]"
},
{
"name": "Jaap van Otterdijk",
"email": "[email protected]"
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.0"
},
"time": "2024-04-09T21:13:58+00:00"
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.8.2",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "153ae662783729388a584b4361f2545e4d841e3c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/153ae662783729388a584b4361f2545e4d841e3c",
"reference": "153ae662783729388a584b4361f2545e4d841e3c",
"shasum": ""
},
"require": {
"doctrine/deprecations": "^1.0",
"php": "^7.3 || ^8.0",
"phpdocumentor/reflection-common": "^2.0",
"phpstan/phpdoc-parser": "^1.13"
},
"require-dev": {
"ext-tokenizer": "*",
"phpbench/phpbench": "^1.2",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-phpunit": "^1.1",
"phpunit/phpunit": "^9.5",
"rector/rector": "^0.13.9",
"vimeo/psalm": "^4.25"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-1.x": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "[email protected]"
}
],
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.2"
},
"time": "2024-02-23T11:10:43+00:00"
},
{
"name": "phpstan/phpdoc-parser",
"version": "1.28.0",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb",
"reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"require-dev": {
"doctrine/annotations": "^2.0",
"nikic/php-parser": "^4.15",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.5",
"phpstan/phpstan-phpunit": "^1.1",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/phpunit": "^9.5",
"symfony/process": "^5.2"
},
"type": "library",
"autoload": {
"psr-4": {
"PHPStan\\PhpDocParser\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.28.0"
},
"time": "2024-04-03T18:51:33+00:00"
},
{
"name": "psr/cache",
"version": "3.0.0",
@@ -3220,6 +3442,165 @@
],
"time": "2024-01-29T20:11:03+00:00"
},
{
"name": "symfony/property-access",
"version": "v7.0.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/property-access.git",
"reference": "1c268ba954ccc5e78cf035b391abb67759e24423"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-access/zipball/1c268ba954ccc5e78cf035b391abb67759e24423",
"reference": "1c268ba954ccc5e78cf035b391abb67759e24423",
"shasum": ""
},
"require": {
"php": ">=8.2",
"symfony/property-info": "^6.4|^7.0"
},
"require-dev": {
"symfony/cache": "^6.4|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\PropertyAccess\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "[email protected]"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides functions to read and write from/to an object or array using a simple string notation",
"homepage": "https://symfony.com",
"keywords": [
"access",
"array",
"extraction",
"index",
"injection",
"object",
"property",
"property-path",
"reflection"
],
"support": {
"source": "https://github.com/symfony/property-access/tree/v7.0.6"
},
"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-19T11:57:22+00:00"
},
{
"name": "symfony/property-info",
"version": "v7.0.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/property-info.git",
"reference": "b8844ddce7d53f78b57ec9be59da80fceddf3167"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-info/zipball/b8844ddce7d53f78b57ec9be59da80fceddf3167",
"reference": "b8844ddce7d53f78b57ec9be59da80fceddf3167",
"shasum": ""
},
"require": {
"php": ">=8.2",
"symfony/string": "^6.4|^7.0"
},
"conflict": {
"phpdocumentor/reflection-docblock": "<5.2",
"phpdocumentor/type-resolver": "<1.5.1",
"symfony/dependency-injection": "<6.4",
"symfony/serializer": "<6.4"
},
"require-dev": {
"phpdocumentor/reflection-docblock": "^5.2",
"phpstan/phpdoc-parser": "^1.0",
"symfony/cache": "^6.4|^7.0",
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/serializer": "^6.4|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\PropertyInfo\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kévin Dunglas",
"email": "[email protected]"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Extracts information about PHP class' properties using metadata of popular sources",
"homepage": "https://symfony.com",
"keywords": [
"doctrine",
"phpdoc",
"property",
"symfony",
"type",
"validator"
],
"support": {
"source": "https://github.com/symfony/property-info/tree/v7.0.6"
},
"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-28T09:20:36+00:00"
},
{
"name": "symfony/routing",
"version": "v7.0.6",
@@ -3380,6 +3761,101 @@
],
"time": "2024-01-23T15:02:46+00:00"
},
{
"name": "symfony/serializer",
"version": "v7.0.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/serializer.git",
"reference": "dbdc0c04c28ac53de1fa35f92fca26e9b1345d98"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/serializer/zipball/dbdc0c04c28ac53de1fa35f92fca26e9b1345d98",
"reference": "dbdc0c04c28ac53de1fa35f92fca26e9b1345d98",
"shasum": ""
},
"require": {
"php": ">=8.2",
"symfony/polyfill-ctype": "~1.8"
},
"conflict": {
"phpdocumentor/reflection-docblock": "<3.2.2",
"phpdocumentor/type-resolver": "<1.4.0",
"symfony/dependency-injection": "<6.4",
"symfony/property-access": "<6.4",
"symfony/property-info": "<6.4",
"symfony/uid": "<6.4",
"symfony/validator": "<6.4",
"symfony/yaml": "<6.4"
},
"require-dev": {
"phpdocumentor/reflection-docblock": "^3.2|^4.0|^5.0",
"seld/jsonlint": "^1.10",
"symfony/cache": "^6.4|^7.0",
"symfony/config": "^6.4|^7.0",
"symfony/console": "^6.4|^7.0",
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/error-handler": "^6.4|^7.0",
"symfony/filesystem": "^6.4|^7.0",
"symfony/form": "^6.4|^7.0",
"symfony/http-foundation": "^6.4|^7.0",
"symfony/http-kernel": "^6.4|^7.0",
"symfony/messenger": "^6.4|^7.0",
"symfony/mime": "^6.4|^7.0",
"symfony/property-access": "^6.4|^7.0",
"symfony/property-info": "^6.4|^7.0",
"symfony/translation-contracts": "^2.5|^3",
"symfony/uid": "^6.4|^7.0",
"symfony/validator": "^6.4|^7.0",
"symfony/var-dumper": "^6.4|^7.0",
"symfony/var-exporter": "^6.4|^7.0",
"symfony/yaml": "^6.4|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Serializer\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "[email protected]"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/serializer/tree/v7.0.6"
},
"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-28T09:20:36+00:00"
},
{
"name": "symfony/service-contracts",
"version": "v3.4.2",
@@ -3839,6 +4315,64 @@
}
],
"time": "2024-01-23T15:02:46+00:00"
},
{
"name": "webmozart/assert",
"version": "1.11.0",
"source": {
"type": "git",
"url": "https://github.com/webmozarts/assert.git",
"reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991",
"reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"php": "^7.2 || ^8.0"
},
"conflict": {
"phpstan/phpstan": "<0.12.20",
"vimeo/psalm": "<4.6.1 || 4.6.2"
},
"require-dev": {
"phpunit/phpunit": "^8.5.13"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.10-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\Assert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "[email protected]"
}
],
"description": "Assertions to validate method input/output with nice error messages.",
"keywords": [
"assert",
"check",
"validate"
],
"support": {
"issues": "https://github.com/webmozarts/assert/issues",
"source": "https://github.com/webmozarts/assert/tree/1.11.0"
},
"time": "2022-06-03T18:03:27+00:00"
}
],
"packages-dev": [
+48
View File
@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240420232815 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SEQUENCE room_category_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE room_category_details_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE room_category_photo_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE room_category (id INT NOT NULL, name VARCHAR(64) NOT NULL, description TEXT DEFAULT NULL, bed_type VARCHAR(64) DEFAULT NULL, max_guest_num INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE room_category_details (id INT NOT NULL, room_category_id INT NOT NULL, details_section VARCHAR(255) NOT NULL, detail_value VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_3735FABB67333DD ON room_category_details (room_category_id)');
$this->addSql('CREATE TABLE room_category_photo (id INT NOT NULL, room_category_id INT NOT NULL, path VARCHAR(255) NOT NULL, alt_text VARCHAR(255) DEFAULT NULL, kind VARCHAR(30) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_B5843CAC67333DD ON room_category_photo (room_category_id)');
$this->addSql('ALTER TABLE room_category_details ADD CONSTRAINT FK_3735FABB67333DD FOREIGN KEY (room_category_id) REFERENCES room_category (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE room_category_photo ADD CONSTRAINT FK_B5843CAC67333DD FOREIGN KEY (room_category_id) REFERENCES room_category (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE room_category_id_seq CASCADE');
$this->addSql('DROP SEQUENCE room_category_details_id_seq CASCADE');
$this->addSql('DROP SEQUENCE room_category_photo_id_seq CASCADE');
$this->addSql('ALTER TABLE room_category_details DROP CONSTRAINT FK_3735FABB67333DD');
$this->addSql('ALTER TABLE room_category_photo DROP CONSTRAINT FK_B5843CAC67333DD');
$this->addSql('DROP TABLE room_category');
$this->addSql('DROP TABLE room_category_details');
$this->addSql('DROP TABLE room_category_photo');
}
}
+34
View File
@@ -0,0 +1,34 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Doctrine\ORM\EntityManagerInterface;
use App\Repository\RoomCategoryRepository;
use App\Entity\RoomCategory;
use App\Entity\RoomCategoryDetails;
use App\Entity\RoomCategoryPhoto;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\Serializer\Context\Normalizer\ObjectNormalizerContextBuilder;
class RoomCategoryController extends AbstractController
{
#[Route('/room/category', name: 'app_room_category')]
public function getAll(RoomCategoryRepository $catRepo, SerializerInterface $serializer): Response
{
$catList = $catRepo->findAll();
return $this->json(["results" => $catList]);
}
#[Route('/room/category/{id}', name: 'app_room_category')]
public function getById(RoomCategory $category, SerializerInterface $serializer): Response
{
return $this->json($category);
}
}
+162
View File
@@ -0,0 +1,162 @@
<?php
namespace App\Entity;
use App\Repository\RoomCategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\Serializer\Annotation\Ignore;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: RoomCategoryRepository::class)]
class RoomCategory
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 64)]
private ?string $name = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\Column(length: 64, nullable: true)]
private ?string $bedType = null;
#[ORM\Column]
private ?int $maxGuestNum = null;
/**
* @var Collection<int, RoomCategoryPhoto>
*/
#[ORM\OneToMany(targetEntity: RoomCategoryPhoto::class, mappedBy: 'roomCategory', orphanRemoval: true)]
private Collection $roomCategoryPhotos;
/**
* @var Collection<int, RoomCategoryDetails>
*/
#[ORM\OneToMany(targetEntity: RoomCategoryDetails::class, mappedBy: 'roomCategory', orphanRemoval: true)]
private Collection $roomCategoryDetails;
public function __construct()
{
$this->roomCategoryPhotos = new ArrayCollection();
$this->roomCategoryDetails = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
public function getBedType(): ?string
{
return $this->bedType;
}
public function setBedType(?string $bedType): static
{
$this->bedType = $bedType;
return $this;
}
public function getMaxGuestNum(): ?int
{
return $this->maxGuestNum;
}
public function setMaxGuestNum(int $maxGuestNum): static
{
$this->maxGuestNum = $maxGuestNum;
return $this;
}
/**
* @return Collection<int, RoomCategoryPhoto>
*/
public function getRoomCategoryPhotos(): Collection
{
return $this->roomCategoryPhotos;
}
public function addRoomCategoryPhoto(RoomCategoryPhoto $roomCategoryPhoto): static
{
if (!$this->roomCategoryPhotos->contains($roomCategoryPhoto)) {
$this->roomCategoryPhotos->add($roomCategoryPhoto);
$roomCategoryPhoto->setRoomCategory($this);
}
return $this;
}
public function removeRoomCategoryPhoto(RoomCategoryPhoto $roomCategoryPhoto): static
{
if ($this->roomCategoryPhotos->removeElement($roomCategoryPhoto)) {
// set the owning side to null (unless already changed)
if ($roomCategoryPhoto->getRoomCategory() === $this) {
$roomCategoryPhoto->setRoomCategory(null);
}
}
return $this;
}
/**
* @return Collection<int, RoomCategoryDetails>
*/
public function getRoomCategoryDetails(): Collection
{
return $this->roomCategoryDetails;
}
public function addRoomCategoryDetail(RoomCategoryDetails $roomCategoryDetail): static
{
if (!$this->roomCategoryDetails->contains($roomCategoryDetail)) {
$this->roomCategoryDetails->add($roomCategoryDetail);
$roomCategoryDetail->setRoomCategory($this);
}
return $this;
}
public function removeRoomCategoryDetail(RoomCategoryDetails $roomCategoryDetail): static
{
if ($this->roomCategoryDetails->removeElement($roomCategoryDetail)) {
// set the owning side to null (unless already changed)
if ($roomCategoryDetail->getRoomCategory() === $this) {
$roomCategoryDetail->setRoomCategory(null);
}
}
return $this;
}
}
+70
View File
@@ -0,0 +1,70 @@
<?php
namespace App\Entity;
use App\Repository\RoomCategoryDetailsRepository;
use Symfony\Component\Serializer\Annotation\Ignore;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: RoomCategoryDetailsRepository::class)]
class RoomCategoryDetails
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $detailsSection = null;
#[ORM\Column(length: 255)]
private ?string $detailValue = null;
#[ORM\ManyToOne(inversedBy: 'roomCategoryDetails')]
#[ORM\JoinColumn(nullable: false)]
#[Ignore]
private ?RoomCategory $roomCategory = null;
public function getId(): ?int
{
return $this->id;
}
public function getDetailsSection(): ?string
{
return $this->detailsSection;
}
public function setDetailsSection(string $detailsSection): static
{
$this->detailsSection = $detailsSection;
return $this;
}
public function getDetailValue(): ?string
{
return $this->detailValue;
}
public function setDetailValue(string $detailValue): static
{
$this->detailValue = $detailValue;
return $this;
}
#[Ignore]
public function getRoomCategory(): ?RoomCategory
{
return $this->roomCategory;
}
#[Ignore]
public function setRoomCategory(?RoomCategory $roomCategory): static
{
$this->roomCategory = $roomCategory;
return $this;
}
}
+85
View File
@@ -0,0 +1,85 @@
<?php
namespace App\Entity;
use App\Repository\RoomCategoryPhotoRepository;
use Symfony\Component\Serializer\Annotation\Ignore;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: RoomCategoryPhotoRepository::class)]
class RoomCategoryPhoto
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $path = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $altText = null;
#[ORM\Column(length: 30)]
private ?string $kind = null;
#[ORM\ManyToOne(inversedBy: 'roomCategoryPhotos')]
#[ORM\JoinColumn(nullable: false)]
#[Ignore]
private ?RoomCategory $roomCategory = null;
public function getId(): ?int
{
return $this->id;
}
public function getPath(): ?string
{
return $this->path;
}
public function setPath(string $path): static
{
$this->path = $path;
return $this;
}
public function getAltText(): ?string
{
return $this->altText;
}
public function setAltText(?string $altText): static
{
$this->altText = $altText;
return $this;
}
public function getKind(): ?string
{
return $this->kind;
}
public function setKind(string $kind): static
{
$this->kind = $kind;
return $this;
}
#[Ignore]
public function getRoomCategory(): ?RoomCategory
{
return $this->roomCategory;
}
#[Ignore]
public function setRoomCategory(?RoomCategory $roomCategory): static
{
$this->roomCategory = $roomCategory;
return $this;
}
}
@@ -0,0 +1,48 @@
<?php
namespace App\Repository;
use App\Entity\RoomCategoryDetails;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<RoomCategoryDetails>
*
* @method RoomCategoryDetails|null find($id, $lockMode = null, $lockVersion = null)
* @method RoomCategoryDetails|null findOneBy(array $criteria, array $orderBy = null)
* @method RoomCategoryDetails[] findAll()
* @method RoomCategoryDetails[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class RoomCategoryDetailsRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, RoomCategoryDetails::class);
}
// /**
// * @return RoomCategoryDetails[] Returns an array of RoomCategoryDetails objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('r')
// ->andWhere('r.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('r.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?RoomCategoryDetails
// {
// return $this->createQueryBuilder('r')
// ->andWhere('r.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}
@@ -0,0 +1,48 @@
<?php
namespace App\Repository;
use App\Entity\RoomCategoryPhoto;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<RoomCategoryPhoto>
*
* @method RoomCategoryPhoto|null find($id, $lockMode = null, $lockVersion = null)
* @method RoomCategoryPhoto|null findOneBy(array $criteria, array $orderBy = null)
* @method RoomCategoryPhoto[] findAll()
* @method RoomCategoryPhoto[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class RoomCategoryPhotoRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, RoomCategoryPhoto::class);
}
// /**
// * @return RoomCategoryPhoto[] Returns an array of RoomCategoryPhoto objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('r')
// ->andWhere('r.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('r.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?RoomCategoryPhoto
// {
// return $this->createQueryBuilder('r')
// ->andWhere('r.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}
+48
View File
@@ -0,0 +1,48 @@
<?php
namespace App\Repository;
use App\Entity\RoomCategory;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<RoomCategory>
*
* @method RoomCategory|null find($id, $lockMode = null, $lockVersion = null)
* @method RoomCategory|null findOneBy(array $criteria, array $orderBy = null)
* @method RoomCategory[] findAll()
* @method RoomCategory[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class RoomCategoryRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, RoomCategory::class);
}
// /**
// * @return RoomCategory[] Returns an array of RoomCategory objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('r')
// ->andWhere('r.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('r.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?RoomCategory
// {
// return $this->createQueryBuilder('r')
// ->andWhere('r.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}