File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments