Update Builder logic to set the node status

This commit is contained in:
Oliver Davies 2024-01-17 10:57:16 +00:00
parent c2e8d312c8
commit 529eb1458e

View file

@ -12,15 +12,21 @@ final class PostBuilder {
private string $title;
private bool $isPublished = TRUE;
public static function create(): self {
return new self();
}
public function isNotPublished(): self {
$this->isPublished = FALSE;
return $this;
}
public function isPublished(): self {
$this->isPublished = TRUE;
return $this;
}
@ -38,6 +44,7 @@ final class PostBuilder {
public function getPost(): NodeInterface {
$post = Node::create([
'status' => $this->isPublished,
'title' => $this->title,
'type' => 'post',
]);