Update Builder logic to set the node status
This commit is contained in:
parent
c2e8d312c8
commit
529eb1458e
|
@ -12,15 +12,21 @@ final class PostBuilder {
|
||||||
|
|
||||||
private string $title;
|
private string $title;
|
||||||
|
|
||||||
|
private bool $isPublished = TRUE;
|
||||||
|
|
||||||
public static function create(): self {
|
public static function create(): self {
|
||||||
return new self();
|
return new self();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isNotPublished(): self {
|
public function isNotPublished(): self {
|
||||||
|
$this->isPublished = FALSE;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isPublished(): self {
|
public function isPublished(): self {
|
||||||
|
$this->isPublished = TRUE;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +44,7 @@ final class PostBuilder {
|
||||||
|
|
||||||
public function getPost(): NodeInterface {
|
public function getPost(): NodeInterface {
|
||||||
$post = Node::create([
|
$post = Node::create([
|
||||||
|
'status' => $this->isPublished,
|
||||||
'title' => $this->title,
|
'title' => $this->title,
|
||||||
'type' => 'post',
|
'type' => 'post',
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in a new issue