2016-11-21 20:55:05 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Topic extends DataStore {
|
|
|
|
const TABLE = 'topic';
|
|
|
|
|
2016-11-24 22:02:18 +01:00
|
|
|
public static function getProps() {
|
2016-11-21 20:55:05 +01:00
|
|
|
return [
|
|
|
|
'name',
|
|
|
|
'icon',
|
|
|
|
'iconColor',
|
|
|
|
'ownArticleList'
|
|
|
|
];
|
|
|
|
}
|
2016-11-23 02:27:05 +01:00
|
|
|
|
|
|
|
public function toArray() {
|
|
|
|
$articlesArray = [];
|
|
|
|
|
|
|
|
foreach($this->ownArticleList as $article) {
|
|
|
|
$articlesArray[] = $article->toArray();
|
|
|
|
}
|
|
|
|
|
|
|
|
return [
|
2016-12-05 03:51:45 +01:00
|
|
|
'id' => $this->id,
|
2016-11-23 02:27:05 +01:00
|
|
|
'name' => $this->name,
|
|
|
|
'icon' => $this->icon,
|
|
|
|
'iconColor' => $this->iconColor,
|
|
|
|
'articles' => $articlesArray
|
|
|
|
];
|
|
|
|
}
|
2016-11-21 20:55:05 +01:00
|
|
|
}
|