Add father/mother links to NPCs, derived from the relationships text
- Npc gains self-referencing father/mother (nullable, ON DELETE SET NULL); editable as dropdowns on the per-NPC form - app:npc:link-parents parses "son/daughter/child of X [and Y]" from the Relationships / Notes column, resolves the names within the same family, and works out which parent is father vs mother from husband/wife/widow(er) and son/daughter/sister/brother cues (plus a small name-gender table for the few the text can't disambiguate). --dry-run / --force. 92/180 linked, none ambiguous. - migrations now pin ENGINE=InnoDB - the local WAMP MariaDB defaults to MyISAM, which silently drops foreign keys Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -43,6 +43,14 @@ class Npc
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $relationships = null;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: self::class)]
|
||||
#[ORM\JoinColumn(name: 'father_id', onDelete: 'SET NULL')]
|
||||
private ?Npc $father = null;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: self::class)]
|
||||
#[ORM\JoinColumn(name: 'mother_id', onDelete: 'SET NULL')]
|
||||
private ?Npc $mother = null;
|
||||
|
||||
#[ORM\Column(enumType: VillageStatus::class)]
|
||||
private VillageStatus $villageStatus = VillageStatus::Established;
|
||||
|
||||
@@ -143,6 +151,30 @@ class Npc
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFather(): ?Npc
|
||||
{
|
||||
return $this->father;
|
||||
}
|
||||
|
||||
public function setFather(?Npc $father): static
|
||||
{
|
||||
$this->father = $father;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMother(): ?Npc
|
||||
{
|
||||
return $this->mother;
|
||||
}
|
||||
|
||||
public function setMother(?Npc $mother): static
|
||||
{
|
||||
$this->mother = $mother;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getVillageStatus(): VillageStatus
|
||||
{
|
||||
return $this->villageStatus;
|
||||
|
||||
Reference in New Issue
Block a user