rater/src/Entity/Rating.php

68 lines
1.3 KiB
PHP
Raw Normal View History

2026-06-04 21:29:10 +02:00
<?php
namespace App\Entity;
use App\Repository\RatingRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: RatingRepository::class)]
class Rating
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'ratings')]
#[ORM\JoinColumn(nullable: false)]
2026-06-04 21:46:16 +02:00
private ?Subject $subject = null;
2026-06-04 21:29:10 +02:00
#[ORM\Column(type: Types::SMALLINT, nullable: true)]
2026-06-04 21:46:16 +02:00
private ?int $score = null;
2026-06-04 21:29:10 +02:00
2026-06-05 00:20:33 +02:00
#[ORM\Column(type: Types::TEXT, options: ['default' => ''])]
private string $note = '';
2026-06-04 21:29:10 +02:00
public function getId(): ?int
{
return $this->id;
}
2026-06-04 21:46:16 +02:00
public function getSubject(): ?Subject
2026-06-04 21:29:10 +02:00
{
2026-06-04 21:46:16 +02:00
return $this->subject;
2026-06-04 21:29:10 +02:00
}
2026-06-04 21:46:16 +02:00
public function setSubject(?Subject $subject): static
2026-06-04 21:29:10 +02:00
{
2026-06-04 21:46:16 +02:00
$this->subject = $subject;
2026-06-04 21:29:10 +02:00
return $this;
}
2026-06-04 21:46:16 +02:00
public function getScore(): ?int
2026-06-04 21:29:10 +02:00
{
2026-06-04 21:46:16 +02:00
return $this->score;
2026-06-04 21:29:10 +02:00
}
2026-06-04 21:46:16 +02:00
public function setScore(?int $score): static
2026-06-04 21:29:10 +02:00
{
2026-06-04 21:46:16 +02:00
$this->score = $score;
2026-06-04 21:29:10 +02:00
return $this;
}
2026-06-05 00:20:33 +02:00
public function getNote(): string
{
return $this->note;
}
public function setNote(?string $note = ''): static
{
$this->note = $note;
return $this;
}
2026-06-04 21:29:10 +02:00
}