Fix integrity constraint violation error
This commit is contained in:
parent
86b5c18f8d
commit
7d79a2ea14
|
@ -34,11 +34,14 @@ final class PostBuilder {
|
||||||
|
|
||||||
public function getPost(): NodeInterface {
|
public function getPost(): NodeInterface {
|
||||||
$post = Node::create([
|
$post = Node::create([
|
||||||
'created' => $this?->created->getTimestamp(),
|
|
||||||
'title' => $this->title,
|
'title' => $this->title,
|
||||||
'type' => 'post',
|
'type' => 'post',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if ($this->created !== NULL) {
|
||||||
|
$post->setCreatedTime($this->created->getTimestamp());
|
||||||
|
}
|
||||||
|
|
||||||
$post->save();
|
$post->save();
|
||||||
|
|
||||||
return $post;
|
return $post;
|
||||||
|
|
Loading…
Reference in a new issue