#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,23 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace adrienpayet\comments;
|
||||
use adrienpayet\D2P\data\Position;
|
||||
|
||||
class Comment extends BaseComment
|
||||
{
|
||||
protected $position;
|
||||
protected ?Position $position = null;
|
||||
protected string $type = "comment";
|
||||
protected array $replies = [];
|
||||
|
||||
public function __construct($data) {
|
||||
parent::__construct($data);
|
||||
$this->position = $data['position'] ?? null;
|
||||
}
|
||||
|
||||
public function position() {
|
||||
return $this->position;
|
||||
if (isset($data["position"])) {
|
||||
$this->position = new Position($data['position']);
|
||||
}
|
||||
}
|
||||
|
||||
public function toArray() {
|
||||
$array = parent::toArray();
|
||||
$array['position'] = $this->position;
|
||||
$array['type'] = $this->type;
|
||||
$array['replies'] = $this->replies;
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue