DB changed.
- Removed RoomCategoryDetails. - Updated some constraints and fields.
This commit is contained in:
@@ -33,7 +33,6 @@ class RoomCategoryCrudController extends AbstractCrudController
|
||||
TextField::new('description'),
|
||||
TextField::new('bedType'),
|
||||
IntegerField::new('maxGuestNum'),
|
||||
CollectionField::new('roomCategoryDetails')->useEntryCrudForm(),
|
||||
CollectionField::new('roomCategoryPhotos')->useEntryCrudForm()
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\RoomCategoryDetails;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||
|
||||
class RoomCategoryDetailsCrudController extends AbstractCrudController
|
||||
{
|
||||
public static function getEntityFqcn(): string
|
||||
{
|
||||
return RoomCategoryDetails::class;
|
||||
}
|
||||
|
||||
|
||||
public function configureFields(string $pageName): iterable
|
||||
{
|
||||
return [
|
||||
TextField::new('detailsSection'),
|
||||
TextField::new('detailValue'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace App\Controller\Admin;
|
||||
use App\Entity\RoomCategoryPhoto;
|
||||
use App\Entity\RoomCategoryPhotoKinds;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\{TextField, ChoiceField};
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\{TextField, IntegerField};
|
||||
|
||||
class RoomCategoryPhotoCrudController extends AbstractCrudController
|
||||
{
|
||||
@@ -18,7 +18,7 @@ class RoomCategoryPhotoCrudController extends AbstractCrudController
|
||||
{
|
||||
yield TextField::new('path');
|
||||
yield TextField::new('altText');
|
||||
yield ChoiceField::new('kind')->setChoices(['Main' => 'main', 'Bathroom' => 'bathroom', 'Other' => 'other']);
|
||||
yield IntegerField::new('order');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,6 @@ 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;
|
||||
|
||||
@@ -14,7 +14,7 @@ class ConfigVariable
|
||||
#[ORM\Column(length: 32, unique: true, nullable: false)]
|
||||
private string $key = "";
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
#[ORM\Column(length: 255, nullable: false)]
|
||||
private ?string $value = null;
|
||||
|
||||
#[ORM\Column(type: 'string', enumType: ConfigSectionType::class, nullable: false)]
|
||||
|
||||
@@ -20,7 +20,7 @@ class FareTable
|
||||
#[ORM\JoinColumn(nullable: false, onDelete: "CASCADE")]
|
||||
private ?RoomCategory $roomCategory = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: false)]
|
||||
private ?\DateTimeInterface $startDate = null;
|
||||
|
||||
#[ORM\Column(type : Types::DATETIME_MUTABLE, nullable: true)]
|
||||
|
||||
@@ -19,7 +19,7 @@ class RoomAvailability
|
||||
#[ORM\JoinColumn(nullable: false, onDelete: "CASCADE")]
|
||||
private ?RoomCategory $roomCategory = null;
|
||||
|
||||
#[ORM\Column]
|
||||
#[ORM\Column(nullable: false)]
|
||||
private ?int $numAvailable = null;
|
||||
|
||||
public function getDay(): ?\DateTimeInterface
|
||||
|
||||
@@ -25,7 +25,7 @@ class RoomCategory
|
||||
#[ORM\Column(length: 64, nullable: true)]
|
||||
private ?string $bedType = null;
|
||||
|
||||
#[ORM\Column]
|
||||
#[ORM\Column(nullable: false)]
|
||||
private ?int $maxGuestNum = null;
|
||||
|
||||
/**
|
||||
@@ -34,16 +34,9 @@ class RoomCategory
|
||||
#[ORM\OneToMany(targetEntity: RoomCategoryPhoto::class, mappedBy: 'roomCategory', orphanRemoval: true, cascade: ['persist'])]
|
||||
private Collection $roomCategoryPhotos;
|
||||
|
||||
/**
|
||||
* @var Collection<int, RoomCategoryDetails>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: RoomCategoryDetails::class, mappedBy: 'roomCategory', orphanRemoval: true, cascade: ['persist'])]
|
||||
private Collection $roomCategoryDetails;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->roomCategoryPhotos = new ArrayCollection();
|
||||
$this->roomCategoryDetails = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
@@ -129,36 +122,6 @@ class RoomCategory
|
||||
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;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->name;
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -14,14 +14,14 @@ class RoomCategoryPhoto
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
#[ORM\Column(length: 255, nullable: false)]
|
||||
private ?string $path = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $altText = null;
|
||||
|
||||
#[ORM\Column(length: 30)]
|
||||
private ?string $kind = null;
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $photoOrder = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'roomCategoryPhotos')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
@@ -57,14 +57,14 @@ class RoomCategoryPhoto
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getKind(): ?string
|
||||
public function getPhotoOrder(): ?int
|
||||
{
|
||||
return $this->kind;
|
||||
return $this->photoOrder;
|
||||
}
|
||||
|
||||
public function setKind(string $kind): static
|
||||
public function setPhotoOrder(?int $photoOrder): static
|
||||
{
|
||||
$this->kind = $kind;
|
||||
$this->photoOrder = $photoOrder;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class RoomFare
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'roomFares')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
#[ORM\JoinColumn(nullable: false, onDelete: "CASCADE")]
|
||||
private ?FareTable $fareTable = null;
|
||||
|
||||
#[ORM\Column]
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
<?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()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user