Segelparade / www / symfonyproject / src / Entity / Image.php
Image.php
Raw
<?php

namespace App\Entity;

use App\Repository\ImageRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity(repositoryClass: ImageRepository::class)]
class Image
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    #[Groups(['image_details', 'image_full'])]
    private ?int $id = null;

    #[ORM\Column(length: 255)]
    #[Groups(['image_details', 'image_full'])]
    private ?string $image_file = null;

    #[ORM\Column(type: Types::DATE_MUTABLE)]
    #[Groups(['image_details', 'image_full'])]
    private ?\DateTimeInterface $uploaded = null;

    #[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
    #[Groups(['image_full'])]
    private ?\DateTimeInterface $accepted = null;

    #[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
    #[Groups(['image_full'])]
    private ?\DateTimeInterface $deleted = null;

    #[ORM\ManyToOne]
    #[ORM\JoinColumn(nullable: false)]
    #[Groups(['image_full'])]
    private ?User $fk_user = null;

    #[ORM\ManyToMany(targetEntity: Tag::class, inversedBy: 'fk_image')]
    #[Groups(['image_full'])]
    private Collection $tag;

    #[ORM\ManyToMany(targetEntity: Processing::class, inversedBy: 'fk_image')]
    #[Groups(['image_full'])]
    private Collection $processing;

    #[ORM\OneToMany(targetEntity: Conversation::class, mappedBy: 'fk_image')]
    #[Groups(['image_full'])]
    private Collection $conversation;

    #[ORM\Column(nullable: true)]
    #[Groups(['image_details', 'image_full'])]
    private ?float $age = null;

    #[ORM\Column(length: 255, nullable: true)]
    #[Groups(['image_details', 'image_full'])]
    private ?string $name = null;

    public function __construct()
    {
        $this->tag = new ArrayCollection();
        $this->processing = new ArrayCollection();
        $this->conversation = new ArrayCollection();
    }

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

    public function getImageFile(): ?string
    {
        return $this->image_file;
    }

    public function setImageFile(string $image_file): static
    {
        $this->image_file = $image_file;

        return $this;
    }

    public function getUploaded(): ?\DateTimeInterface
    {
        return $this->uploaded;
    }

    public function setUploaded(\DateTimeInterface $uploaded): static
    {
        $this->uploaded = $uploaded;

        return $this;
    }

    public function getAccepted(): ?\DateTimeInterface
    {
        return $this->accepted;
    }

    public function setAccepted(?\DateTimeInterface $accepted): static
    {
        $this->accepted = $accepted;

        return $this;
    }

    public function getDeleted(): ?\DateTimeInterface
    {
        return $this->deleted;
    }

    public function setDeleted(?\DateTimeInterface $deleted): static
    {
        $this->deleted = $deleted;

        return $this;
    }

    public function getFkUser(): ?User
    {
        return $this->fk_user;
    }

    public function setFkUser(?User $fk_user): static
    {
        $this->fk_user = $fk_user;

        return $this;
    }

    /**
     * @return Collection<int, Tag>
     */
    public function getTag(): Collection
    {
        return $this->tag;
    }

    public function addTag(Tag $tag): static
    {
        if (!$this->tag->contains($tag)) {
            $this->tag->add($tag);
        }

        return $this;
    }

    public function removeTag(Tag $tag): static
    {
        $this->tag->removeElement($tag);

        return $this;
    }

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

    public function addProcessing(Processing $processing): static
    {
        if (!$this->processing->contains($processing)) {
            $this->processing->add($processing);
        }

        return $this;
    }

    public function removeProcessing(Processing $processing): static
    {
        $this->processing->removeElement($processing);

        return $this;
    }

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

    public function addConversation(conversation $conversation): static
    {
        if (!$this->conversation->contains($conversation)) {
            $this->conversation->add($conversation);
            $conversation->setFkImage($this);
        }

        return $this;
    }

    public function removeConversation(conversation $conversation): static
    {
        if ($this->conversation->removeElement($conversation)) {
            // set the owning side to null (unless already changed)
            if ($conversation->getFkImage() === $this) {
                $conversation->setFkImage(null);
            }
        }

        return $this;
    }

    public function getAge(): ?float
    {
        return $this->age;
    }

    public function setAge(?float $age): static
    {
        $this->age = $age;

        return $this;
    }

    public function getName(): ?string
    {
        return $this->name;
    }

    public function setName(?string $name): static
    {
        $this->name = $name;

        return $this;
    }
}