Implement snip content names
This commit is contained in:
@ -13,18 +13,19 @@ readonly class SnipContentService
|
||||
private EntityManagerInterface $em,
|
||||
) {}
|
||||
|
||||
public function update(Snip $snip, string $snipContents): void
|
||||
public function update(Snip $snip, string $contents, ?string $contentName): void
|
||||
{
|
||||
$parentContent = $snip->getActiveVersion();
|
||||
if (self::rebuildText($parentContent) === $snipContents) {
|
||||
if (self::rebuildText($parentContent) === $contents) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create new snipContent entity with previous one as parent
|
||||
$content = new SnipContent();
|
||||
$content
|
||||
->setText($snipContents)
|
||||
->setText($contents)
|
||||
->setSnip($snip)
|
||||
->setName($contentName)
|
||||
;
|
||||
if ($parentContent !== null) {
|
||||
$content->setParent($parentContent);
|
||||
|
Reference in New Issue
Block a user