* active flag is now working as intended * iframe slide type added * team-slide connection is now many-to-many
371 lines
7.9 KiB
PHP
Executable File
371 lines
7.9 KiB
PHP
Executable File
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Entity;
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Gedmo\Mapping\Annotation as Gedmo;
|
|
use JsonSerializable;
|
|
|
|
/**
|
|
* @ORM\Entity
|
|
* @ORM\Table(name="teams")
|
|
*/
|
|
class Team implements JsonSerializable
|
|
{
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\GeneratedValue(strategy="IDENTITY")
|
|
* @ORM\Column(name="id", type="integer")
|
|
* @var int
|
|
*/
|
|
private $id;
|
|
|
|
/**
|
|
* @ORM\Column(name="name", type="string", length=200, unique=true)
|
|
* @var string
|
|
*/
|
|
private $name;
|
|
|
|
/**
|
|
* @ORM\Column(name="members", type="json")
|
|
* @var array
|
|
*/
|
|
private $members;
|
|
|
|
/**
|
|
* @ORM\ManyToMany(targetEntity="Slide", mappedBy="teams", cascade={"persist", "remove"})
|
|
* @ORM\JoinTable(
|
|
* name="team_slides",
|
|
* joinColumns={
|
|
* @ORM\JoinColumn(name="team_id", referencedColumnName="id")
|
|
* },
|
|
* inverseJoinColumns={
|
|
* @ORM\JoinColumn(name="slide_id", referencedColumnName="id")
|
|
* }
|
|
* )
|
|
* @var Slide[]|Collection
|
|
*/
|
|
private $slides;
|
|
|
|
/**
|
|
* @ORM\Column(name="filter_id", type="integer", nullable=true)
|
|
* @var int
|
|
*/
|
|
private $filterId;
|
|
|
|
/**
|
|
* @ORM\Column(name="backlog_column", type="json", nullable=true)
|
|
* @var KanbanColumn
|
|
*/
|
|
private $backlogColumn;
|
|
|
|
/**
|
|
* @ORM\Column(name="inprogress_column", type="json", nullable=true)
|
|
* @var KanbanColumn
|
|
*/
|
|
private $inprogressColumn;
|
|
|
|
/**
|
|
* @ORM\Column(name="verification_column", type="json", nullable=true)
|
|
* @var KanbanColumn
|
|
*/
|
|
private $verificationColumn;
|
|
|
|
/**
|
|
* @ORM\Column(name="done_column", type="json", nullable=true)
|
|
* @var KanbanColumn
|
|
*/
|
|
private $doneColumn;
|
|
|
|
/**
|
|
* @ORM\Column(name="is_active", type="boolean")
|
|
* @var bool
|
|
*/
|
|
private $isActive;
|
|
|
|
/**
|
|
* @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;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->members = new \ArrayObject;
|
|
$this->slides = new ArrayCollection;
|
|
|
|
$this->backlogColumn = new KanbanColumn();
|
|
$this->inprogressColumn = new KanbanColumn();
|
|
$this->verificationColumn = new KanbanColumn();
|
|
$this->doneColumn = new KanbanColumn();
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
/**
|
|
* @param int $id
|
|
* @return Team
|
|
*/
|
|
public function setId(?int $id): Team
|
|
{
|
|
$this->id = $id;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getName(): ?string
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
/**
|
|
* @param string $name
|
|
* @return Team
|
|
*/
|
|
public function setName(string $name): Team
|
|
{
|
|
$this->name = $name;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function getMembers()
|
|
{
|
|
return $this->members;
|
|
}
|
|
|
|
/**
|
|
* @param array $members
|
|
* @return Team
|
|
*/
|
|
public function setMembers(array $members): Team
|
|
{
|
|
$this->members = $members;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @param Slide $slide
|
|
* @return Team
|
|
*/
|
|
public function addSlide(Slide $slide): Team
|
|
{
|
|
if (!$this->slides->contains($slide)) {
|
|
$this->slides->removeElement($slide);
|
|
}
|
|
//$slide->addTeam($this);
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Slide[]|Collection
|
|
*/
|
|
public function getSlides(): ?Collection
|
|
{
|
|
return $this->slides;
|
|
}
|
|
|
|
/**
|
|
* @param Slide $slide
|
|
* @return Team
|
|
*/
|
|
public function removeSlide(Slide $slide): Team
|
|
{
|
|
if ($this->slides->contains($slide)) {
|
|
$this->slides->removeElement($slide);
|
|
}
|
|
//$slide->removeTeam($this);
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getFilterId(): ?int
|
|
{
|
|
return $this->filterId;
|
|
}
|
|
|
|
/**
|
|
* @param int $filterId
|
|
* @return Team
|
|
*/
|
|
public function setFilterId(?int $filterId): Team
|
|
{
|
|
$this->filterId = $filterId;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return array|KanbanColumn
|
|
*/
|
|
public function getBacklogColumn()
|
|
{
|
|
return $this->backlogColumn;
|
|
}
|
|
|
|
/**
|
|
* @param array $backlogColumn
|
|
* @return Team
|
|
*/
|
|
public function setBacklogColumn(?array $backlogColumn): Team
|
|
{
|
|
$this->backlogColumn = $backlogColumn;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return array|KanbanColumn
|
|
*/
|
|
public function getInprogressColumn()
|
|
{
|
|
return $this->inprogressColumn;
|
|
}
|
|
|
|
/**
|
|
* @param array $inprogressColumn
|
|
* @return Team
|
|
*/
|
|
public function setInprogressColumn(array $inprogressColumn): Team
|
|
{
|
|
$this->inprogressColumn = $inprogressColumn;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return array|KanbanColumn
|
|
*/
|
|
public function getVerificationColumn()
|
|
{
|
|
return $this->verificationColumn;
|
|
}
|
|
|
|
/**
|
|
* @param array $verificationColumn
|
|
* @return Team
|
|
*/
|
|
public function setVerificationColumn(?array $verificationColumn): Team
|
|
{
|
|
$this->verificationColumn = $verificationColumn;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return array|KanbanColumn
|
|
*/
|
|
public function getDoneColumn()
|
|
{
|
|
return $this->doneColumn;
|
|
}
|
|
|
|
/**
|
|
* @param array $doneColumn
|
|
* @return Team
|
|
*/
|
|
public function setDoneColumn(?array $doneColumn): Team
|
|
{
|
|
$this->doneColumn = $doneColumn;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
public function isActive(): ?bool
|
|
{
|
|
return $this->isActive;
|
|
}
|
|
|
|
/**
|
|
* @param bool $isActive
|
|
* @return Team
|
|
*/
|
|
public function setIsActive(bool $isActive): Team
|
|
{
|
|
$this->isActive = $isActive;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return \DateTimeImmutable
|
|
*/
|
|
public function getCreatedAt(): ?\DateTimeImmutable
|
|
{
|
|
return $this->createdAt;
|
|
}
|
|
|
|
/**
|
|
* @param \DateTimeImmutable $createdAt
|
|
* @return Team
|
|
*/
|
|
public function setCreatedAt(\DateTimeImmutable $createdAt): Team
|
|
{
|
|
$this->createdAt = $createdAt;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return \DateTimeImmutable
|
|
*/
|
|
public function getUpdatedAt(): ?\DateTimeImmutable
|
|
{
|
|
return $this->updatedAt;
|
|
}
|
|
|
|
/**
|
|
* @param \DateTimeImmutable $updatedAt
|
|
* @return Team
|
|
*/
|
|
public function setUpdatedAt(\DateTimeImmutable $updatedAt): Team
|
|
{
|
|
$this->updatedAt = $updatedAt;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function jsonSerialize()
|
|
{
|
|
return [
|
|
'id' => $this->getId(),
|
|
'name' => $this->getName(),
|
|
'members' => $this->getMembers(),
|
|
'filterId' => $this->getFilterId(),
|
|
'backlogColumn' => $this->getBacklogColumn() ?? new KanbanColumn(),
|
|
'inprogressColumn' => $this->getInprogressColumn() ?? new KanbanColumn(),
|
|
'verificationColumn' => $this->getVerificationColumn() ?? new KanbanColumn(),
|
|
'doneColumn' => $this->getDoneColumn() ?? new KanbanColumn(),
|
|
'isActive' => $this->isActive(),
|
|
'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,
|
|
];
|
|
}
|
|
}
|