Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
trash
/
vhost_www.rec-app.app_1716798588
/
htdocs
/
src
/
Entity
/
/srv/data/trash/vhost_www.rec-app.app_1716798588/htdocs/src/Entity/PhoneModel.php
<?php namespace App\Entity; use Doctrine\ORM\Mapping as ORM; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\PhoneModelRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Symfony\Component\HttpFoundation\File\File; use Vich\UploaderBundle\Mapping\Annotation as Vich; use Symfony\Component\Serializer\Annotation\Groups; /** * @ApiResource( * normalizationContext={"groups"={"phoneModel:read"}}, * denormalizationContext={"groups"={"phoneModel:write"}} * ) * @ORM\Entity(repositoryClass=PhoneModelRepository::class) * @Vich\Uploadable */ class PhoneModel { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") * @Groups({"phoneModel:read", "phoneBrand:read"}) */ private $id; /** * @ORM\Column(type="string", length=255) * @Groups({"phoneModel:read", "phoneModel:write"}) */ private $name; /** * @ORM\Column(type="text", nullable=true) * @Groups({"phoneModel:read", "phoneModel:write"}) */ private $description; /** * @Vich\UploadableField(mapping="phone_image", fileNameProperty="imageName") * @var File|null * @Groups({"phoneModel:read", "phoneModel:write"}) */ private $imageFile; /** * @ORM\Column(type="string", length=255, nullable=true) * @Groups({"phoneModel:read", "phoneModel:write"}) */ private $imageName; /** * @ORM\OneToMany(targetEntity=PhoneModelOption::class, mappedBy="phoneModel", orphanRemoval=true, cascade={"persist"}) * @Groups({"phoneModel:read", "phoneModel:write"}) */ private $phoneModelOptions; /** * @ORM\ManyToOne(targetEntity=PhoneBrand::class, inversedBy="phoneModels") * @ORM\JoinColumn(nullable=false) * @Groups({"phoneModel:read", "phoneModel:write"}) */ private $phoneBrand; /** * @ORM\Column(type="datetime") * @Groups({"phoneModel:read", "phoneModel:write"}) */ private $createdAt; /** * @ORM\Column(type="datetime", nullable=true) * @Groups({"phoneModel:read", "phoneModel:write"}) */ private $updatedAt; public function __construct() { $this->phoneModelOptions = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): self { $this->description = $description; return $this; } public function getImageFile(): ?File { return $this->imageFile; } public function setImageFile(?File $imageFile = null): void { $this->imageFile = $imageFile; if (null !== $imageFile) { $this->updatedAt = new \DateTimeImmutable(); } } public function getImageName(): ?string { return $this->imageName; } public function setImageName(?string $imageName): self { $this->imageName = $imageName; return $this; } /** * @return Collection|PhoneModelOption[] */ public function getPhoneModelOptions(): Collection { return $this->phoneModelOptions; } public function addPhoneModelOption(PhoneModelOption $phoneModelOption): self { if (!$this->phoneModelOptions->contains($phoneModelOption)) { $this->phoneModelOptions[] = $phoneModelOption; $phoneModelOption->setPhoneModel($this); } return $this; } public function removePhoneModelOption(PhoneModelOption $phoneModelOption): self { if ($this->phoneModelOptions->removeElement($phoneModelOption)) { // set the owning side to null (unless already changed) if ($phoneModelOption->getPhoneModel() === $this) { $phoneModelOption->setPhoneModel(null); } } return $this; } public function getPhoneBrand(): ?PhoneBrand { return $this->phoneBrand; } public function setPhoneBrand(?PhoneBrand $phoneBrand): self { $this->phoneBrand = $phoneBrand; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(\DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } }