#68 - create comment create working (notification to adapt)
This commit is contained in:
parent
3d4ddc12fc
commit
cf83edc1e6
11 changed files with 106 additions and 158 deletions
|
|
@ -1,40 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace adrienpayet\comments;
|
||||
use adrienpayet\D2P\data\location\Location;
|
||||
use adrienpayet\D2P\data\Author;
|
||||
|
||||
class BaseComment {
|
||||
protected $href;
|
||||
protected $location;
|
||||
protected $position;
|
||||
protected $replies;
|
||||
protected $text;
|
||||
protected $author;
|
||||
protected $date;
|
||||
protected $id;
|
||||
protected $type;
|
||||
protected $isRead;
|
||||
protected string $type;
|
||||
protected Location $location;
|
||||
protected string $text;
|
||||
protected Author $author;
|
||||
protected string $date;
|
||||
protected string $id;
|
||||
|
||||
public function __construct($data) {
|
||||
$this->type = $data["type"];
|
||||
$this->location = new Location($data["location"]);
|
||||
$this->text = $data["text"];
|
||||
$this->author = new Author($data["author"]);
|
||||
$this->date = $data["date"];
|
||||
$this->id = $data["id"];
|
||||
$this->isRead = "false";
|
||||
}
|
||||
|
||||
public function toArray() {
|
||||
return [
|
||||
'location' => $this->location,
|
||||
'position' => $this->position,
|
||||
'replies' => $this->replies,
|
||||
'text' => $this->text,
|
||||
'author' => $this->author,
|
||||
'date' => $this->date,
|
||||
'id' => $this->id,
|
||||
'type' => $this->type,
|
||||
'isRead' => $this->isRead
|
||||
"location" => $this->location->toArray(),
|
||||
"text" => $this->text,
|
||||
"author" => $this->author->toArray(),
|
||||
"date" => $this->date,
|
||||
"id" => $this->id,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue