src/Entity/Image.php line 14
<?php
namespace App\Entity;
use App\Entity\Timestamps;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\ImageRepository;
use Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator;
use Symfony\Component\Uid\Ulid;
use Gedmo\Mapping\Annotation as Gedmo;
#[ORM\Entity(repositoryClass: ImageRepository::class)]
#[Gedmo\SoftDeleteable(fieldName: 'deletedAt', timeAware: false, hardDelete: true)]
class Image
{
use Timestamps;
#[ORM\Id]
#[ORM\Column(type: 'ulid', unique: true)]
#[ORM\GeneratedValue(strategy: "CUSTOM")]
#[ORM\CustomIdGenerator(class: UlidGenerator::class)]
private ?Ulid $id = null;
#[ORM\Column(type: 'string', length: 255)]
private $url;
#[ORM\Column(type: 'string', length: 255)]
private $alt;
#[ORM\ManyToOne(targetEntity: Post::class, inversedBy: 'images')]
#[ORM\JoinColumn(nullable: false)]
private $post;
public function __construct()
{
$this->alt = "Clever Nursery";
}
public function getId(): ?Ulid
{
return $this->id;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(string $url): self
{
$this->url = $url;
return $this;
}
public function getAlt(): ?string
{
return $this->alt;
}
public function setAlt(string $alt): self
{
$this->alt = $alt;
return $this;
}
public function getPost(): ?Post
{
return $this->post;
}
public function setPost(?Post $post): self
{
$this->post = $post;
return $this;
}
}