You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
163 lines
3.1 KiB
163 lines
3.1 KiB
<?php
|
|
namespace App\Entity;
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping\Column;
|
|
use Doctrine\ORM\Mapping\Entity;
|
|
use Doctrine\ORM\Mapping\JoinColumn;
|
|
use Doctrine\ORM\Mapping\ManyToMany;
|
|
use Doctrine\ORM\Mapping\ManyToOne;
|
|
use Doctrine\ORM\Mapping\Table;
|
|
use Symfony\Component\Serializer\Annotation\Groups;
|
|
|
|
#[Entity]
|
|
#[Table(name: '`character`')]
|
|
class Character extends Thing
|
|
{
|
|
|
|
#[ManyToOne()]
|
|
#[JoinColumn(onDelete: 'cascade')]
|
|
#[Groups('public')]
|
|
public ?Dojo $dojo;
|
|
|
|
#[Column]
|
|
#[Groups('public')]
|
|
public string $name;
|
|
|
|
#[Column]
|
|
#[Groups('detail')]
|
|
public int $strength;
|
|
|
|
#[Column]
|
|
#[Groups('detail')]
|
|
public int $constitution;
|
|
|
|
#[Column]
|
|
#[Groups('detail')]
|
|
public int $agility;
|
|
|
|
/** @var Technique[] */
|
|
#[Groups('detail')]
|
|
#[ManyToMany(targetEntity: Technique::class)]
|
|
#[JoinColumn(nullable: false)]
|
|
public iterable $techniques;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->techniques = new ArrayCollection();
|
|
}
|
|
|
|
/**
|
|
* Calculates the aged based on the ulid value?
|
|
*/
|
|
public function getAge(): int
|
|
{
|
|
return 21;
|
|
}
|
|
|
|
public function getDojo(): ?Dojo
|
|
{
|
|
return $this->dojo;
|
|
}
|
|
|
|
public function setDojo(?Dojo $dojo): static
|
|
{
|
|
$this->dojo = $dojo;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getName(): ?string
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
public function setName(string $name): static
|
|
{
|
|
$this->name = $name;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getStrength(): ?int
|
|
{
|
|
return $this->strength;
|
|
}
|
|
|
|
public function setStrength(int $strength): static
|
|
{
|
|
$this->strength = $strength;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getConstition(): ?int
|
|
{
|
|
return $this->constition;
|
|
}
|
|
|
|
public function setConstition(int $constition): static
|
|
{
|
|
$this->constition = $constition;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getAgility(): ?int
|
|
{
|
|
return $this->agility;
|
|
}
|
|
|
|
public function setAgility(int $agility): static
|
|
{
|
|
$this->agility = $agility;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Technique>
|
|
*/
|
|
public function getTechniques(): Collection
|
|
{
|
|
return $this->techniques;
|
|
}
|
|
|
|
public function setTechniques(string $techniques): static
|
|
{
|
|
$this->techniques = $techniques;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function addTechnique(Technique $technique): static
|
|
{
|
|
if (!$this->techniques->contains($technique)) {
|
|
$this->techniques->add($technique);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeTechnique(Technique $technique): static
|
|
{
|
|
$this->techniques->removeElement($technique);
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getConstitution(): ?int
|
|
{
|
|
return $this->constitution;
|
|
}
|
|
|
|
public function setConstitution(int $constitution): static
|
|
{
|
|
$this->constitution = $constitution;
|
|
|
|
return $this;
|
|
}
|
|
}
|
|
|