<?php
namespace CoreBundle\Entity;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use JsonSerializable;
/**
* @ORM\Table("peer_session")
* @ORM\Entity(repositoryClass="CoreBundle\Entity\PeerSessionRepository")
*/
class PeerSession implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private int $id;
/**
* @ORM\Column(type="string", nullable=true)
*/
protected ?string $name;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private ?DateTime $startTime;
/**
* @ORM\Column(type="integer")
*/
private int $durationStage1;
/**
* @ORM\Column(type="integer")
*/
private int $durationStage2;
/**
* @ORM\Column(type="integer")
*/
private int $durationStage3;
/**
* @ORM\ManyToOne(targetEntity="Classroom", inversedBy="peerSessions")
* @ORM\JoinColumn(name="classroom", referencedColumnName="id", onDelete="CASCADE")
*/
private Classroom $classroom;
/**
* @ORM\ManyToOne(targetEntity="PeerTheme", inversedBy="peerSessions")
* @ORM\JoinColumn(name="peer_theme_id", referencedColumnName="id")
*/
private PeerTheme $peerTheme;
/**
* @var Collection|ArrayCollection|PeerGroup[]
*
* @ORM\OneToMany(targetEntity="CoreBundle\Entity\PeerGroup", mappedBy="peerSession", cascade={"persist", "remove"})
*/
private Collection $peerGroups;
/**
* @ORM\Column(type="integer", nullable=false, options={"default"=1})
*/
private int $isEnabled = 1;
/**
* @ORM\ManyToOne(targetEntity="PeerThemeClassType")
* @ORM\JoinColumn(name="peer_theme_class_type_id", referencedColumnName="id")
*/
private PeerThemeClassType $peerThemeClassType;
public function __construct()
{
$this->peerGroups = new ArrayCollection();
}
/**
* @return string
*/
public function getName():string
{
return $this->name;
}
/**
* @param string $name
*/
public function setName(string $name): void
{
$this->name = $name;
}
public function getId(): int
{
return $this->id;
}
public function getStartTime(): ?DateTime
{
return $this->startTime;
}
public function setStartTime(DateTime $startTime)
{
$this->startTime = $startTime;
}
public function getDurationStage1(): int
{
return $this->durationStage1;
}
public function setDurationStage1(int $durationStage1)
{
$this->durationStage1 = $durationStage1;
}
public function getDurationStage2(): int
{
return $this->durationStage2;
}
public function setDurationStage2(int $durationStage2)
{
$this->durationStage2 = $durationStage2;
}
public function getDurationStage3(): int
{
return $this->durationStage3;
}
public function setDurationStage3(int $durationStage3)
{
$this->durationStage3 = $durationStage3;
}
public function getClassroom(): Classroom
{
return $this->classroom;
}
public function setClassroom(Classroom $classroom)
{
$this->classroom = $classroom;
}
public function getPeerTheme(): PeerTheme
{
return $this->peerTheme;
}
public function setPeerTheme(PeerTheme $peerTheme)
{
$this->peerTheme = $peerTheme;
}
/**
* @return Collection|ArrayCollection|PeerGroup[]
*/
public function getPeerGroups(): Collection
{
return $this->peerGroups;
}
public function addPeerGroup(PeerGroup $peerGroup)
{
$peerGroup->setPeerSession($this);
$this->peerGroups->add($peerGroup);
}
public function getIsEnabled(): int
{
return $this->isEnabled;
}
public function setIsEnabled(int $isEnabled)
{
$this->isEnabled = $isEnabled;
}
public function getPeerThemeClassType(): PeerThemeClassType
{
return $this->peerThemeClassType;
}
public function setPeerThemeClassType(PeerThemeClassType $peerThemeClassType)
{
$this->peerThemeClassType = $peerThemeClassType;
}
public function jsonSerialize(): mixed
{
return [
"id" => $this->getId(),
"startTime" => $this->getStartTime(),
"classroom" => $this->getClassroom(),
"duration" => $this->getDurationStage1(),
];
}
}