<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\SchoolClassTeacherMapping;
class SchoolClass {
/**
* @var integer
*/
private $id;
/**
* @var string|null
*/
private $classCode;
/**
* @var string|null
*/
private $numberPart;
/**
* @var string|null
*/
private $textPart;
/**
* @var string
*/
private $userPassword;
/**
* @var \App\Entity\User
*/
private $schoolClassUser;
/**
* @var \DateTime
*/
private $createdAt;
/**
* @var \Doctrine\Common\Collections\Collection
*/
private $schoolClassTeacherMappings;
/**
* @var \App\Entity\School
*/
private $school;
/**
* @var \App\Entity\SchoolClassGrade
*/
private $grade;
/**
* @var \App\Entity\SchoolClassYear
*/
private $schoolClassYear;
/**
* @var int
*/
private $numberOfStudents;
/**
* @var int
*/
private $historyId;
/**
* @var \App\Entity\SchoolClassState
*/
private $schoolClassState;
/**
* @var \Doctrine\Common\Collections\Collection
*/
private $gameCategories;
/**
* @var \DateTime|null
*/
private $deletedAt;
/**
* Constructor
*/
public function __construct() {
$this->gameCategories = new ArrayCollection();
$this->schoolClassTeacherMappings = new ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId() {
return $this->id;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return SchoolClass
*/
public function setCreatedAt($createdAt) {
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt() {
return $this->createdAt;
}
/**
* Add schoolClassTeacherMapping
*
* @param \App\Entity\SchoolClassTeacherMapping $schoolClassTeacherMapping
*
* @return SchoolClass
*/
public function addSchoolClassTeacherMapping(\App\Entity\SchoolClassTeacherMapping $schoolClassTeacherMapping) {
$this->schoolClassTeacherMappings[] = $schoolClassTeacherMapping;
return $this;
}
/**
* Remove schoolClassTeacherMapping
*
* @param \App\Entity\SchoolClassTeacherMapping $schoolClassTeacherMapping
*/
public function removeSchoolClassTeacherMapping(\App\Entity\SchoolClassTeacherMapping $schoolClassTeacherMapping) {
$this->schoolClassTeacherMappings->removeElement($schoolClassTeacherMapping);
}
/**
* Get schoolClassTeacherMappings
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getSchoolClassTeacherMappings() {
return $this->schoolClassTeacherMappings;
}
/**
* Set school
*
* @param \App\Entity\School $school
*
* @return SchoolClass
*/
public function setSchool(\App\Entity\School $school = null) {
$this->school = $school;
return $this;
}
/**
* Get school
*
* @return \App\Entity\School
*/
public function getSchool() {
return $this->school;
}
/**
* Set grade
*
* @param \App\Entity\SchoolClassGrade $grade
*
* @return SchoolClass
*/
public function setGrade(\App\Entity\SchoolClassGrade $grade = null) {
$this->grade = $grade;
return $this;
}
/**
* Get grade
*
* @return \App\Entity\SchoolClassGrade
*/
public function getGrade() {
return $this->grade;
}
/**
* Set schoolClassYear
*
* @param \App\Entity\SchoolClassYear $schoolClassYear
*
* @return SchoolClass
*/
public function setSchoolClassYear(\App\Entity\SchoolClassYear $schoolClassYear = null) {
$this->schoolClassYear = $schoolClassYear;
return $this;
}
/**
* Get schoolClassYear
*
* @return \App\Entity\SchoolClassYear
*/
public function getSchoolClassYear() {
return $this->schoolClassYear;
}
/**
* Set historyId.
*
* @param int $historyId
*
* @return SchoolClass
*/
public function setHistoryId($historyId) {
$this->historyId = $historyId;
return $this;
}
/**
* Get historyId.
*
* @return int
*/
public function getHistoryId() {
return $this->historyId;
}
/**
* Set deletedAt.
*
* @param \DateTime|null $deletedAt
*
* @return SchoolClass
*/
public function setDeletedAt($deletedAt = null) {
$this->deletedAt = $deletedAt;
return $this;
}
/**
* Get deletedAt.
*
* @return \DateTime|null
*/
public function getDeletedAt() {
return $this->deletedAt;
}
/**
* Set numberOfStudents.
*
* @param int $numberOfStudents
*
* @return SchoolClass
*/
public function setNumberOfStudents($numberOfStudents) {
$this->numberOfStudents = $numberOfStudents;
return $this;
}
/**
* Get numberOfStudents.
*
* @return int
*/
public function getNumberOfStudents() {
return $this->numberOfStudents;
}
/**
* Set userPassword.
*
* @param string $userPassword
*
* @return SchoolClass
*/
public function setUserPassword($userPassword) {
$this->userPassword = $userPassword;
return $this;
}
/**
* Get userPassword.
*
* @return string
*/
public function getUserPassword() {
return $this->userPassword;
}
/**
* Set schoolClassUser.
*
* @param \App\Entity\User|null $schoolClassUser
*
* @return SchoolClass
*/
public function setSchoolClassUser(\App\Entity\User $schoolClassUser = null) {
$this->schoolClassUser = $schoolClassUser;
return $this;
}
/**
* Get schoolClassUser.
*
* @return \App\Entity\User|null
*/
public function getSchoolClassUser() {
return $this->schoolClassUser;
}
/**
* Get teacherNames
*
* @return string
*/
public function getTeacherNames() {
$names = '';
/* @var $teacherMapping SchoolClassTeacherMapping */
foreach ($this->schoolClassTeacherMappings as $teacherMapping) {
$names = $names . $teacherMapping->getUser()->getUserData()->getFullName() . ' ';
}
return $names;
}
/**
* Set numberPart.
*
* @param string|null $numberPart
*
* @return SchoolClass
*/
public function setNumberPart($numberPart = null) {
$this->numberPart = $numberPart;
return $this;
}
/**
* Get numberPart.
*
* @return string|null
*/
public function getNumberPart() {
return $this->numberPart;
}
/**
* Set textPart.
*
* @param string|null $textPart
*
* @return SchoolClass
*/
public function setTextPart($textPart = null) {
$this->textPart = $textPart;
return $this;
}
/**
* Get textPart.
*
* @return string|null
*/
public function getTextPart() {
return $this->textPart;
}
/**
* Get name
*
* @return string
*/
public function getName() {
return trim($this->numberPart .''. $this->textPart);
}
public function getClassCode(): ?string {
return $this->classCode;
}
public function setClassCode(?string $classCode): void {
$this->classCode = $classCode;
}
public function getFullName() {
$name = $this->getName();
$schoolYear = '';
if (!empty($this->schoolClassYear)) {
$schoolYear = ' (' . $this->schoolClassYear->getName() . ')';
}
return trim("$name $schoolYear");
}
public function getNameExtended() {
$count = $this->numberOfStudents;
$numberPart = $this->numberPart;
$textPart = $this->textPart;
return trim("$numberPart $textPart ($count SchülerInnen)");
}
/**
* Set schoolClassState.
*
* @param \App\Entity\SchoolClassState|null $schoolClassState
*
* @return SchoolClass
*/
public function setSchoolClassState(\App\Entity\SchoolClassState $schoolClassState = null) {
$this->schoolClassState = $schoolClassState;
return $this;
}
/**
* Get schoolClassState.
*
* @return \App\Entity\SchoolClassState|null
*/
public function getSchoolClassState() {
return $this->schoolClassState;
}
public function getGameCategories() {
return $this->gameCategories;
}
public function setGameCategories($gameCategories) {
$this->gameCategories = $gameCategories;
}
public function addGameCategory($gameCategory) {
$this->gameCategories->add($gameCategory);
}
public function isActive() {
if (empty($this->schoolClassState)) {
return false;
}
$stateID = $this->schoolClassState->getId();
if ($stateID != 1) {
return false;
}
return true;
}
}