ninenote/src/ninenote-1.0/src/Entity/Score.php

67 lines
1.4 KiB
PHP

<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* Score
*
* @ORM\Entity(repositoryClass="App\Repository\ScoreRepository")
* @ORM\Table(name="score",uniqueConstraints={@ORM\UniqueConstraint(name="unique01", columns={"student_id","control_id"})})
* @UniqueEntity(fields={"student","control"}, message="Cette élève a déjà une note pour ce contrôle")
*/
class Score
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="Student", inversedBy="scores")
*/
private $student;
/**
* @ORM\ManyToOne(targetEntity="Control", inversedBy="scores")
*/
private $control;
public function getId(): ?int
{
return $this->id;
}
public function getStudent(): ?Student
{
return $this->student;
}
public function setStudent(?Student $student): self
{
$this->student = $student;
return $this;
}
public function getControl(): ?Control
{
return $this->control;
}
public function setControl(?Control $control): self
{
$this->control = $control;
return $this;
}
}