* initial commit
This commit is contained in:
209
src/App/Entity/Slide.php
Normal file
209
src/App/Entity/Slide.php
Normal file
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Gedmo\Mapping\Annotation as Gedmo;
|
||||
use JsonSerializable;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="slides")
|
||||
*/
|
||||
class Slide implements JsonSerializable
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @var int
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="title", type="string", length=200, unique=true)
|
||||
* @var string
|
||||
*/
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Team", inversedBy="slides")
|
||||
* @ORM\JoinColumn(name="team_id", referencedColumnName="id")
|
||||
* @var Team
|
||||
*/
|
||||
private $team;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="slide_data", type="text")
|
||||
* @var string
|
||||
*/
|
||||
private $slideData;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="is_visible", type="boolean")
|
||||
* @var bool
|
||||
*/
|
||||
private $isVisible;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="created_at", type="datetime_immutable", nullable=true)
|
||||
* @Gedmo\Timestampable(on="create")
|
||||
* @var \DateTimeImmutable
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="updated_at", type="datetime_immutable", nullable=true)
|
||||
* @Gedmo\Timestampable(on="update")
|
||||
* @var \DateTimeImmutable
|
||||
*/
|
||||
private $updatedAt;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return Slide
|
||||
*/
|
||||
public function setId(int $id): Slide
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle(): ?string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $title
|
||||
* @return Slide
|
||||
*/
|
||||
public function setTitle(string $title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Team
|
||||
*/
|
||||
public function getTeam(): ?Team
|
||||
{
|
||||
return $this->team;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Team $team
|
||||
* @return Slide
|
||||
*/
|
||||
public function setTeam(Team $team): Slide
|
||||
{
|
||||
$this->team = $team;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSlideData(): ?string
|
||||
{
|
||||
return $this->slideData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $slideData
|
||||
* @return Slide
|
||||
*/
|
||||
public function setSlideData(string $slideData): Slide
|
||||
{
|
||||
$this->slideData = $slideData;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isVisible(): ?bool
|
||||
{
|
||||
return $this->isVisible;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $isVisible
|
||||
* @return Slide
|
||||
*/
|
||||
public function setIsVisible(bool $isVisible): Slide
|
||||
{
|
||||
$this->isVisible = $isVisible;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTimeImmutable
|
||||
*/
|
||||
public function getCreatedAt(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTimeImmutable $createdAt
|
||||
* @return Slide
|
||||
*/
|
||||
public function setCreatedAt(\DateTimeImmutable $createdAt): Slide
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTimeImmutable
|
||||
*/
|
||||
public function getUpdatedAt(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTimeImmutable $updatedAt
|
||||
* @return Slide
|
||||
*/
|
||||
public function setUpdatedAt(\DateTimeImmutable $updatedAt): Slide
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return [
|
||||
'id' => $this->getId(),
|
||||
'title' => $this->getTitle(),
|
||||
'team' => $this->getTeam(),
|
||||
'slideData' => $this->getSlideData(),
|
||||
'isVisible' => $this->isVisible(),
|
||||
'createdAt' => $this->getCreatedAt()
|
||||
? $this->getCreatedAt()->format("Y-m-d H:i:s")
|
||||
: null,
|
||||
'updatedAt' => $this->getUpdatedAt()
|
||||
? $this->getUpdatedAt()->format("Y-m-d H:i:s")
|
||||
: null,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user