Integrate snipContent more tightly into snip and cleanup old code
This commit is contained in:
@ -27,8 +27,8 @@ class Snip
|
||||
#[ORM\OneToMany(mappedBy: 'snip', targetEntity: SnipContent::class, orphanRemoval: true)]
|
||||
private Collection $snipContents;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $activeCommit = null;
|
||||
#[ORM\ManyToOne]
|
||||
private ?SnipContent $activeVersion = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -99,14 +99,19 @@ class Snip
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getActiveCommit(): ?string
|
||||
public function getLatestVersion(): ?SnipContent
|
||||
{
|
||||
return $this->activeCommit;
|
||||
return $this->snipContents->last();
|
||||
}
|
||||
|
||||
public function setActiveCommit(?string $activeCommit): static
|
||||
public function getActiveVersion(): ?SnipContent
|
||||
{
|
||||
$this->activeCommit = $activeCommit;
|
||||
return $this->activeVersion;
|
||||
}
|
||||
|
||||
public function setActiveVersion(?SnipContent $activeVersion): static
|
||||
{
|
||||
$this->activeVersion = $activeVersion;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
Reference in New Issue
Block a user