<?php
/**
* Created by PhpStorm.
* User: audri
* Date: 26/02/15
* Time: 15:12
*/
namespace App\Entity\Users;
use Bo\AdministratorsBundle\Entity\ValidateFlow;
use App\Entity\Educational\Discipline;
use App\Entity\Users\Child as Student;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\Validator\Constraints as Assert;
use App\Entity\Users\User as Base;
/**
* Class teacher
* @package Bo\UserBundle\Entity
* @ORM\Entity(repositoryClass="App\Repository\Users\TeacherRepository")
*/
class Teacher extends Base {
/**
* @var boolean $selected
* @ORM\Column(name="selected",type="boolean")
*/
private $selected;
/**
* @var float
* @ORM\Column(name="contract_hours",type="float",nullable=true)
*/
private $contractHours;
/**
* @var float
* @ORM\Column(name="hours_worked",type="float",nullable=true)
*/
private $hoursWorked;
/********************** ASSOCIATION ************************************/
/**
* @var Discipline $disciplines
* @ORM\ManyToMany(targetEntity="App\Entity\Educational\Discipline",inversedBy="teachers")
* @ORM\JoinTable(name="admin_teachers_disciplines")
*/
private $disciplines;
/**
* @var Child $students
* @ORM\OneToMany(targetEntity="Child",mappedBy="teacher")
*/
private $students;
/*
* @ORM\OneToMany(targetEntity="\Bo\AdministratorsBundle\Entity\ValidateFlow", mappedBy="teacher")
*/
private $validateFlow;
/*
* @ORM\OneToMany(targetEntity="Bo\StudentBundle\Entity\Note", mappedBy="teacher")
*/
private $notes;
/*
* @ORM\OneToMany(targetEntity="\Bo\TeacherBundle\Entity\AbstractTask", cascade={"persist"}, mappedBy="teacher" )
*/
private $abstractTask;
public function __construct()
{
$this->disciplines = new ArrayCollection();
$this->selected = false;
$this->validateFlow = new ArrayCollection();
$this->students = new ArrayCollection();
parent::__construct();
$this->isVerified = true;
}
/**
* @return mixed
*/
public function getDisciplines()
{
return $this->disciplines;
}
/**
* @param mixed $disciplines
*/
public function addDisciplines($disciplines)
{
if(!in_array($disciplines,$this->disciplines))
{
$this->disciplines[] = $disciplines;
}
}
public function setDisciplines($disciplines)
{
$this->disciplines[] = $disciplines;
}
/**
* @return boolean
*/
public function isSelected()
{
return $this->selected;
}
/**
* @param boolean $selected
*/
public function setSelected($selected)
{
$this->selected = $selected;
}
public function getInfoTeacher()
{
$tab = array();
$tab["firstname"] = $this->firstname;
$tab["lastname"] = $this->lastname;
$tab["username"] = $this->username;
foreach($this->disciplines as $discipline)
{
$tab["disciplines"][] = $discipline->getTitle();
}
return $tab;
}
/**
* @return float
*/
public function getContractHours()
{
return $this->contractHours;
}
/**
* @param float $contractHours
*/
public function setContractHours($contractHours)
{
$this->contractHours = $contractHours;
}
/**
* @return float
*/
public function getHoursWorked()
{
return $this->hoursWorked;
}
/**
* @param float $hoursWorked
*/
public function setHoursWorked($hoursWorked)
{
$this->hoursWorked = $hoursWorked;
}
/**
* @return mixed
*/
public function getStudents()
{
return $this->students;
}
/**
* @param mixed $students
*/
public function setStudents($students)
{
$this->students = $students;
}
/**
* @param mixed $students
*/
public function addStudents($students)
{
$this->students[] = $students;
}
/**
* Add notes
*
* @param \Bo\StudentBundle\Entity\Note $notes
* @return Teacher
*/
public function addNote($notes)
{
$this->notes[] = $notes;
return $this;
}
/**
* Remove notes
*
* @param \Bo\StudentBundle\Entity\Note $notes
*/
public function removeNote($notes)
{
$this->notes->removeElement($notes);
}
/**
* Get notes
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getNotes()
{
return $this->notes;
}
/**
* Add abstractTask
*
* @param \Bo\TeacherBundle\Entity\AbstractTask $abstractTask
* @return Teacher
*/
public function addAbstractTask($abstractTask)
{
$this->abstractTask[] = $abstractTask;
return $this;
}
/**
* Remove abstractTask
*
* @param \Bo\TeacherBundle\Entity\AbstractTask $abstractTask
*/
public function removeAbstractTask($abstractTask)
{
$this->abstractTask->removeElement($abstractTask);
}
/**
* Get abstractTask
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getAbstractTask()
{
return $this->abstractTask;
}
/**
* {@inheritdoc}
*/
public function __toString()
{
return $this->getFullname();
}
/**
* Get selected
*
* @return boolean
*/
public function getSelected()
{
return $this->selected;
}
/**
* Add disciplines
*
* @param \Bo\ReferencesBundle\Entity\Discipline $disciplines
* @return Teacher
*/
public function addDiscipline(Discipline $disciplines)
{
$this->disciplines[] = $disciplines;
return $this;
}
/**
* Remove disciplines
*
* @param \Bo\ReferencesBundle\Entity\Discipline $disciplines
*/
public function removeDiscipline(Discipline $disciplines)
{
$this->disciplines->removeElement($disciplines);
}
/**
* Add students
*
* @param \Bo\StudentBundle\Entity\Student $students
* @return Teacher
*/
public function addStudent(Child $students)
{
$this->students[] = $students;
return $this;
}
/**
* Remove students
*
* @param Child $students
*/
public function removeStudent(Child $students)
{
$this->students->removeElement($students);
}
/**
* Add validateFlow
*
* @param \Bo\AdministratorsBundle\Entity\ValidateFlow $validateFlow
* @return Teacher
*/
public function addValidateFlow($validateFlow)
{
$this->validateFlow[] = $validateFlow;
return $this;
}
/**
* Remove validateFlow
*
* @param \Bo\AdministratorsBundle\Entity\ValidateFlow $validateFlow
*/
public function removeValidateFlow($validateFlow)
{
$this->validateFlow->removeElement($validateFlow);
}
/**
* Get validateFlow
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getValidateFlow()
{
return $this->validateFlow;
}
}