src/Entity/Gallery/Photo.php line 13
<?php
namespace App\Entity\Gallery;
use App\Entity\Common\File;
use App\Entity\Traits\UserCreatedInterface;
use App\Entity\Traits\UserUpdatedInterface;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'gallery_photo')]
#[ORM\Entity(repositoryClass: 'App\Repository\Gallery\PhotoRepository')]
#[ORM\HasLifecycleCallbacks]
class Photo implements UserCreatedInterface, UserUpdatedInterface, AlbumItemInterface
{
use \App\Entity\Traits\TrackerFields;
use \App\Entity\Traits\ActiveTrait;
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
#[ORM\Column(type: 'integer')]
private ?int $id;
#[ORM\Column(type: 'integer')]
private int $weight = 50;
#[ORM\Column(type: 'string', length: 15, enumType: ItemType::class, options: ['default' => 'photo'])]
private ItemType $type = ItemType::Photo;
#[ORM\ManyToOne(targetEntity: \App\Entity\Common\File::class, cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(nullable: false)]
private File $file;
#[ORM\ManyToOne(targetEntity: \App\Entity\Gallery\Album::class, inversedBy: 'photos')]
#[ORM\JoinColumn(nullable: false)]
private Album $album;
#[ORM\Column(type: 'json', nullable: true)]
private ?array $data = [];
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @param int|null $id
*/
public function setId(?int $id): void
{
$this->id = $id;
}
/**
* @return int
*/
public function getWeight(): int
{
return $this->weight;
}
/**
* @param int $weight
*/
public function setWeight(int $weight): void
{
$this->weight = $weight;
}
/**
* @return mixed
*/
public function getFile(): File
{
return $this->file;
}
/**
* @param mixed $file
*/
public function setFile(File $file): void
{
$this->file = $file;
}
/**
* @return Album
*/
public function getAlbum(): Album
{
return $this->album;
}
/**
* @param Album $album
*/
public function setAlbum(Album $album): void
{
$this->album = $album;
}
/**
* @return ItemType
*/
public function getType(): ItemType
{
return $this->type;
}
/**
* @param ItemType $type
*/
public function setType(ItemType $type): void
{
$this->type = $type;
}
public function getData(): array
{
if (is_null($this->data)) return [];
return $this->data;
}
/**
* @param array|null $data
*/
public function setData(?array $data): void
{
$this->data = $data;
}
}