Symfony API Platform relation more than one

I’m new in Symfony 6 and I have to create a database structure using api platform

I want to create a table named Place and that place has photos like oneToMany relationship also each place has a address and location and belong to a sellerUser oneToOne but can be null

The selleruser extends by User and there are two type users as SellerUser and CustomeUser

Also each user has a photo, address, location, (string) name, surname, email, password

And I want to use uuid generated by constructor and the owners has a primary key and property objects has a foreign key. I couldn’t implement it.

these are my entities:

User.php :

<?php

namespace AppEntity;

use AppRepositoryUserRepository;
use DoctrineCommonCollectionsArrayCollection;
use DoctrineCommonCollectionsCollection;
use DoctrineORMMapping as ORM;

#[ORMEntity(repositoryClass: UserRepository::class)]
class User
{
    #[ORMId]
    #[ORMGeneratedValue]
    #[ORMColumn]
    private ?int $id = null;

    #[ORMColumn(length: 100)]
    private ?string $name = null;

    #[ORMColumn(length: 100)]
    private ?string $surname = null;

    #[ORMColumn(length: 50)]
    private ?string $email = null;

    #[ORMColumn(length: 255)]
    private ?string $password = null;

    #[ORMColumn]
    private ?DateTimeImmutable $registrationDate = null;

    #[ORMOneToMany(mappedBy: 'owner', targetEntity: Photo::class)]
    private Collection $photos;

    #[ORMOneToMany(mappedBy: 'owner', targetEntity: Address::class)]
    private Collection $address;

    public function __construct()
    {
        $this->photos = new ArrayCollection();
        $this->address = 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 getSurname(): ?string
    {
        return $this->surname;
    }

    public function setSurname(string $surname): static
    {
        $this->surname = $surname;

        return $this;
    }

    public function getEmail(): ?string
    {
        return $this->email;
    }

    public function setEmail(string $email): static
    {
        $this->email = $email;

        return $this;
    }

    public function getPassword(): ?string
    {
        return $this->password;
    }

    public function setPassword(string $password): static
    {
        $this->password = $password;

        return $this;
    }

    public function getRegistrationDate(): ?DateTimeImmutable
    {
        return $this->registrationDate;
    }

    public function setRegistrationDate(DateTimeImmutable $registrationDate): static
    {
        $this->registrationDate = $registrationDate;

        return $this;
    }

    /**
     * @return Collection<int, Photo>
     */
    public function getPhotos(): Collection
    {
        return $this->photos;
    }

    public function addPhoto(Photo $photo): static
    {
        if (!$this->photos->contains($photo)) {
            $this->photos->add($photo);
            $photo->setOwner($this);
        }

        return $this;
    }

    public function removePhoto(Photo $photo): static
    {
        if ($this->photos->removeElement($photo)) {
            // set the owning side to null (unless already changed)
            if ($photo->getOwner() === $this) {
                $photo->setOwner(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection<int, Address>
     */
    public function getAddress(): Collection
    {
        return $this->address;
    }

    public function addAddress(Address $address): static
    {
        if (!$this->address->contains($address)) {
            $this->address->add($address);
            $address->setOwner($this);
        }

        return $this;
    }

    public function removeAddress(Address $address): static
    {
        if ($this->address->removeElement($address)) {
            // set the owning side to null (unless already changed)
            if ($address->getOwner() === $this) {
                $address->setOwner(null);
            }
        }

        return $this;
    }
}

CustomerUser.php:

<?php

namespace AppEntity;

use ApiPlatformMetadataApiResource;
use AppRepositoryCustomerUserRepository;
use DoctrineORMMapping as ORM;

#[ORMEntity(repositoryClass: CustomerUserRepository::class)]
#[ApiResource]
class CustomerUser extends User
{
    #[ORMId]
    #[ORMGeneratedValue]
    #[ORMColumn]
    private ?int $id = null;

    public function getId(): ?int
    {
        return $this->id;
    }
}

SellerUser.php:

<?php

namespace AppEntity;

use ApiPlatformMetadataApiResource;
use AppRepositorySellerUserRepository;
use DoctrineORMMapping as ORM;

#[ORMEntity(repositoryClass: SellerUserRepository::class)]
#[ApiResource]
class SellerUser extends User
{
    #[ORMId]
    #[ORMGeneratedValue]
    #[ORMColumn]
    private ?int $id = null;

    #[ORMOneToOne(cascade: ['persist', 'remove'])]
    private ?Place $place = null;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getPlace(): ?Place
    {
        return $this->place;
    }

    public function setPlace(?Place $place): static
    {
        $this->place = $place;

        return $this;
    }
}

Place.php:

<?php

namespace AppEntity;

use ApiPlatformMetadataApiResource;
use AppRepositoryPlaceRepository;
use DoctrineCommonCollectionsArrayCollection;
use DoctrineCommonCollectionsCollection;
use DoctrineORMMapping as ORM;

#[ORMEntity(repositoryClass: PlaceRepository::class)]
#[ApiResource]
class Place
{
    #[ORMId]
    #[ORMGeneratedValue]
    #[ORMColumn]
    private ?int $id = null;

    #[ORMColumn(length: 100)]
    private ?string $name = null;

    #[ORMOneToMany(mappedBy: 'place', targetEntity: Photo::class)]
    private Collection $photos;

    #[ORMOneToOne(cascade: ['persist', 'remove'])]
    private ?Address $address = null;

    #[ORMOneToOne(inversedBy: 'place', cascade: ['persist', 'remove'])]
    #[ORMJoinColumn(nullable: false)]
    private ?Location $location = null;

    public function __construct()
    {
        $this->photos = 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;
    }

    /**
     * @return Collection<int, Photo>
     */
    public function getPhotos(): Collection
    {
        return $this->photos;
    }

    public function addPhoto(Photo $photo): static
    {
        if (!$this->photos->contains($photo)) {
            $this->photos->add($photo);
            $photo->setPlace($this);
        }

        return $this;
    }

    public function removePhoto(Photo $photo): static
    {
        if ($this->photos->removeElement($photo)) {
            // set the owning side to null (unless already changed)
            if ($photo->getPlace() === $this) {
                $photo->setPlace(null);
            }
        }

        return $this;
    }

    public function getAddress(): ?Address
    {
        return $this->address;
    }

    public function setAddress(?Address $address): static
    {
        $this->address = $address;

        return $this;
    }

    public function getLocation(): ?Location
    {
        return $this->location;
    }

    public function setLocation(Location $location): static
    {
        $this->location = $location;

        return $this;
    }
}

Photo.php:

<?php

namespace AppEntity;

use ApiPlatformMetadataApiResource;
use AppRepositoryPhotoRepository;
use DoctrineDBALTypesTypes;
use DoctrineORMMapping as ORM;

#[ORMEntity(repositoryClass: PhotoRepository::class)]
#[ApiResource]
class Photo
{
    #[ORMId]
    #[ORMGeneratedValue]
    #[ORMColumn]
    private ?int $id = null;

    #[ORMColumn(type: Types::TEXT)]
    private ?string $uri = null;

    #[ORMManyToOne(inversedBy: 'photos')]
    #[ORMJoinColumn(nullable: false)]
    private ?User $owner = null;

    #[ORMManyToOne(inversedBy: 'photos')]
    private ?Place $place = null;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getUri(): ?string
    {
        return $this->uri;
    }

    public function setUri(string $uri): static
    {
        $this->uri = $uri;

        return $this;
    }

    public function getOwner(): ?User
    {
        return $this->owner;
    }

    public function setOwner(?User $owner): static
    {
        $this->owner = $owner;

        return $this;
    }

    public function getPlace(): ?Place
    {
        return $this->place;
    }

    public function setPlace(?Place $place): static
    {
        $this->place = $place;

        return $this;
    }
}


Location.php:

<?php

namespace AppEntity;

use ApiPlatformMetadataApiResource;
use AppRepositoryLocationRepository;
use DoctrineORMMapping as ORM;

#[ORMEntity(repositoryClass: LocationRepository::class)]
#[ApiResource]
class Location
{
    #[ORMId]
    #[ORMGeneratedValue]
    #[ORMColumn]
    private ?int $id = null;

    #[ORMColumn]
    private ?int $latitude = null;

    #[ORMColumn]
    private ?int $longitude = null;

    #[ORMOneToOne(mappedBy: 'location', cascade: ['persist', 'remove'])]
    private ?Place $place = null;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getLatitude(): ?int
    {
        return $this->latitude;
    }

    public function setLatitude(int $latitude): static
    {
        $this->latitude = $latitude;

        return $this;
    }

    public function getLongitude(): ?int
    {
        return $this->longitude;
    }

    public function setLongitude(int $longitude): static
    {
        $this->longitude = $longitude;

        return $this;
    }

    public function getPlace(): ?Place
    {
        return $this->place;
    }

    public function setPlace(Place $place): static
    {
        // set the owning side of the relation if necessary
        if ($place->getLocation() !== $this) {
            $place->setLocation($this);
        }

        $this->place = $place;

        return $this;
    }
}

Address.php:

<?php

namespace AppEntity;

use ApiPlatformMetadataApiResource;
use AppRepositoryAddressRepository;
use DoctrineORMMapping as ORM;

#[ORMEntity(repositoryClass: AddressRepository::class)]
#[ApiResource]
class Address
{
    #[ORMId]
    #[ORMGeneratedValue]
    #[ORMColumn]
    private ?int $id = null;

    #[ORMColumn(length: 100)]
    private ?string $country = null;

    #[ORMColumn(length: 100, nullable: true)]
    private ?string $city = null;

    #[ORMColumn(length: 100, nullable: true)]
    private ?string $district = null;

    #[ORMColumn(length: 20, nullable: true)]
    private ?string $postCode = null;

    #[ORMManyToOne(inversedBy: 'address')]
    private ?User $owner = null;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getCountry(): ?string
    {
        return $this->country;
    }

    public function setCountry(string $country): static
    {
        $this->country = $country;

        return $this;
    }

    public function getCity(): ?string
    {
        return $this->city;
    }

    public function setCity(?string $city): static
    {
        $this->city = $city;

        return $this;
    }

    public function getDistrict(): ?string
    {
        return $this->district;
    }

    public function setDistrict(?string $district): static
    {
        $this->district = $district;

        return $this;
    }

    public function getPostCode(): ?string
    {
        return $this->postCode;
    }

    public function setPostCode(?string $postCode): static
    {
        $this->postCode = $postCode;

        return $this;
    }

    public function getOwner(): ?User
    {
        return $this->owner;
    }

    public function setOwner(?User $owner): static
    {
        $this->owner = $owner;

        return $this;
    }
}

I want to generate uuid using RamseyUuid->uuid4() and make these relations by foreign key uuid, also I don’t want to create table named user because I just want to use oop methods to not implement same things in seller and customer users

But when I migrate it the database generate user table, also the Photo and Address entities have two different fields for both place and user named owner and place but I want to just one variable named owner for two entity

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật