Skip to content

Commit dbbec5b

Browse files
author
Artem Stepin
committed
fixed phpstan issues
1 parent 3fa90af commit dbbec5b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Entity/AbstractContent.php

+9-3
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ public function createComment(string $comment): ContentComment
181181
$contentComment->setContainerId($this->getId());
182182
$contentComment->setContainerType($this->getType());
183183
$contentComment->setContent($comment);
184-
$contentComment->setSpace($this->getSpace());
184+
if ($this->getSpace()) {
185+
$contentComment->setSpace($this->getSpace());
186+
}
185187
return $contentComment;
186188
}
187189

@@ -193,10 +195,14 @@ public function createComment(string $comment): ContentComment
193195
public function createSubpage(string $title, string $body): ContentPage
194196
{
195197
$contentPage = new ContentPage();
196-
$contentPage->addAncestor($this->id);
198+
if ($this->id) {
199+
$contentPage->addAncestor($this->id);
200+
}
197201
$contentPage->setContent($body);
198202
$contentPage->setTitle($title);
199-
$contentPage->setSpace($this->getSpace());
203+
if ($this->getSpace()) {
204+
$contentPage->setSpace($this->getSpace());
205+
}
200206
return $contentPage;
201207
}
202208

0 commit comments

Comments
 (0)