Skip to content
Snippets Groups Projects
Commit 1470e5cb authored by Адлан Шамавов's avatar Адлан Шамавов
Browse files

STA-965 | Поправил сущность Gallery

parent 2e6c717d
No related branches found
No related tags found
1 merge request!13STA 965
......@@ -3,6 +3,8 @@
namespace App\Entity;
use App\Repository\GalleryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Uid\Uuid;
......@@ -14,39 +16,43 @@ class Gallery
#[ORM\Column(type: 'uuid', unique: true)]
private ?Uuid $id = null;
#[ORM\ManyToOne(inversedBy: 'galleries')]
#[ORM\JoinColumn(nullable: false)]
private ?Restaurant $restaurant = null;
/**
* @var Collection<int, File>
*/
#[ORM\ManyToMany(targetEntity: File::class)]
private Collection $files;
public function __construct()
{
$this->files = new ArrayCollection();
}
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(nullable: false)]
private ?File $file = null;
public function getId(): ?int
public function getId(): ?Uuid
{
return $this->id;
}
public function getRestaurant(): ?Restaurant
/**
* @return Collection<int, File>
*/
public function getFile(): Collection
{
return $this->restaurant;
return $this->files;
}
public function setRestaurant(?Restaurant $restaurant): static
public function addFile(File $file): static
{
$this->restaurant = $restaurant;
if (!$this->files->contains($file)) {
$this->files->add($file);
}
return $this;
}
public function getFile(): ?File
{
return $this->file;
}
public function setFile(File $file): static
public function removeFile(File $file): static
{
$this->file = $file;
$this->files->removeElement($file);
return $this;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment