src/Entity/Character.php line 12
<?php
namespace App\Entity;
use App\Repository\CharacterRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: CharacterRepository::class)]
#[ORM\Table(name: "`character`")]
class Character
{
// #[ORM\Column(type: Types::TEXT)]
// private ?string $display = null;
#[Assert\Positive]
#[ORM\Column]
private ?int $shortcut_path = null;
#[ORM\Id]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $pinyin = null;
// #[ORM\Column(type: Types::TEXT)]
// private ?string $tones = null;
#[ORM\Column(name: "`character`", type: Types::TEXT)]
private ?string $character = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $fz_radical_value = null;
// #[ORM\Column]
// private ?int $sign_id1 = null;
#[ORM\ManyToOne(inversedBy: 'characters')]
#[ORM\JoinColumn(name: 'course_id', referencedColumnName: 'course_id')]
private ?Course $course = null;
#[Assert\Positive]
#[ORM\Column(nullable: true)]
private ?int $placeInCourse = null;
#[ORM\OneToOne(inversedBy: 'origin', targetEntity: self::class, cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(name:'rcc', referencedColumnName: 'id')]
private ?self $rcc = null;
#[ORM\OneToOne(mappedBy: 'rcc', targetEntity: self::class, cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(name:'origin', referencedColumnName: 'id')]
private ?self $origin = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $hypa = null;
public function getId(): ?int
{
return $this->id;
}
// public function getDisplay(): ?string
// {
// return $this->display;
// }
//
// public function setDisplay(string $display): self
// {
// $this->display = $display;
//
// return $this;
// }
public function getShortcutPath(): ?int
{
return $this->shortcut_path;
}
public function setShortcutPath(int $shortcut_path): self
{
$this->shortcut_path = $shortcut_path;
return $this;
}
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function getPinyin(): ?string
{
return $this->pinyin;
}
public function setPinyin(string $pinyin): self
{
$this->pinyin = $pinyin;
return $this;
}
// public function getTones(): ?string
// {
// return $this->tones;
// }
//
// public function setTones(string $tones): self
// {
// $this->tones = $tones;
//
// return $this;
// }
public function getCharacter(): ?string
{
return $this->character;
}
public function setCharacter(string $character): self
{
$this->character = $character;
return $this;
}
public function getFzRadicalValue(): ?string
{
return $this->fz_radical_value;
}
public function setFzRadicalValue(string $fz_radical_value): self
{
$this->fz_radical_value = $fz_radical_value;
return $this;
}
// public function getSignId1(): ?int
// {
// return $this->sign_id1;
// }
//
// public function setSignId1(int $sign_id1): self
// {
// $this->sign_id1 = $sign_id1;
//
// return $this;
// }
public function getCourse(): ?Course
{
return $this->course;
}
public function setCourse(?Course $course): self
{
$this->course = $course;
return $this;
}
public function getPlaceInCourse(): ?int
{
return $this->placeInCourse;
}
public function setPlaceInCourse(?int $placeInCourse): self
{
$this->placeInCourse = $placeInCourse;
return $this;
}
public function getRcc(): ?self
{
return $this->rcc;
}
public function setRcc(?self $rcc): self
{
$this->rcc = $rcc;
return $this;
}
public function getOrigin(): ?self
{
return $this->origin;
}
public function setOrigin(?self $origin): ?self
{
// unset the owning side of the relation if necessary
if ($origin === null && $this->origin !== null) {
$this->origin->setRcc(null);
}
// set the owning side of the relation if necessary
if ($origin !== null && $origin->getRcc() !== $this) {
$origin->setRcc($this);
}
$this->origin = $origin;
return $this;
}
public function getHypa(): ?string
{
return $this->hypa;
}
public function setHypa(?string $hypa): self
{
$this->hypa = $hypa;
return $this;
}
public function __toString(): string
{
return "[$this->id] $this->pinyin";
}
}