createdBy = new NullAccount(); $this->createdAt = new \DateTimeImmutable('now'); } /** * Create history form model * * @param WikiDoc $doc Document * * @return self * * @since 1.0.0 */ public static function createFromDoc(WikiDoc $doc) : self { $hist = new self(); $hist->article = $doc->id; $hist->createdBy = $doc->createdBy; $hist->name = $doc->name; $hist->doc = $doc->doc; $hist->docRaw = $doc->docRaw; $hist->version = $doc->version; return $hist; } /** * {@inheritdoc} */ public function toArray() : array { return [ 'id' => $this->id, 'name' => $this->name, 'doc' => $this->doc, 'docRaw' => $this->docRaw, ]; } /** * {@inheritdoc} */ public function jsonSerialize() : mixed { return $this->toArray(); } }