<?php
namespace CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use JsonSerializable;
use UserBundle\Entity\User;
/**
* @ORM\Table("peer_student")
* @ORM\Entity
*/
class PeerStudent implements JsonSerializable
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private int $id;
/**
* @ORM\Column(name="is_team_leader", type="boolean", options={"default":false})
*/
private bool $isTeamLeader;
/**
* @ORM\ManyToOne(targetEntity="PeerUnit", inversedBy="peerStudents")
* @ORM\JoinColumn(name="PeerUnit", referencedColumnName="id", onDelete="CASCADE")
*/
private PeerUnit $peerUnit;
/**
* @ORM\ManyToOne(targetEntity="UserBundle\Entity\User")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
private User $student;
/**
* @ORM\Column(name="confirmedCooperation", type="boolean");
*/
private bool $confirmedCooperation = false;
public function setConfirmedCooperation(bool $confirmedCooperation): PeerStudent
{
$this->confirmedCooperation = $confirmedCooperation;
return $this;
}
public function getConfirmedCooperation(): bool
{
return $this->confirmedCooperation;
}
public function getId(): int
{
return $this->id;
}
public function setPeerUnit(PeerUnit $peerUnit): PeerStudent
{
$this->peerUnit = $peerUnit;
return $this;
}
public function getPeerUnit(): PeerUnit
{
return $this->peerUnit;
}
public function setStudent(User $student): PeerStudent
{
$this->student = $student;
return $this;
}
public function getStudent(): User
{
return $this->student;
}
public function setIsTeamLeader(bool $isTeamLeader): PeerStudent
{
$this->isTeamLeader = $isTeamLeader;
return $this;
}
public function getIsTeamLeader(): bool
{
return $this->isTeamLeader;
}
public function jsonSerialize(): mixed
{
return [
"id" => $this->id,
"isTeamLeader" => $this->isTeamLeader,
"studentName" => $this->getStudent()->getFullName(),
];
}
}