This is an old revision of the document!
Table of Contents
TopicService
Layer: Service · Source: lib/service/TopicService.php:22 (lines 22–344)
class TopicService
TopicService Class
Docblock Metadata
| Tag | Value |
|---|---|
@category | Service Class |
@author | M.Noermoehammad |
@license | MIT |
@version | 1.0 |
@since | Since Release 1.0 |
Inheritance
No parent, interface or trait. This is a root type.
Constants (0)
None.
Properties (0)
None declared.
Methods (22)
| Visibility | Method | Summary | Line |
|---|---|---|---|
| public | __construct() | (undocumented) | 81 |
| public | setTopicId() | setTopicId | 94 |
| public | setTopicTitle() | setTopicTitle | 105 |
| public | setTopicSlug() | setTopicSlug | 116 |
| public | setTopicStatus() | setTopicStatus | 127 |
| public | setTopicLocale() | setTopicLocale | 138 |
| public | grabTopics() | grabTopics | 149 |
| public | grabTopic() | grabTopic | 160 |
| public | getActiveTopicsApi() | Get paginated active topics for API | 174 |
| public | countActiveTopicsApi() | Count active topics for API | 185 |
| public | getTopicApi() | Get a single topic with post count for API | 196 |
| public | getPostsByTopicApi() | Get paginated posts by topic for API | 211 |
| public | countPostsByTopicApi() | Count published posts by topic for API | 223 |
| public | addTopic() | addTopic | 232 |
| public | modifyTopic() | modifyTopic | 247 |
| public | removeTopic() | removeTopic | 264 |
| public | totalTopics() | totalTopics | 283 |
| public | localeDropDown() | localeDropDown | 295 |
| public | checkTopicSlugExists() | Check if a topic slug already exists. | 306 |
| public | createTopicApi() | Create a topic from raw data for the API. | 317 |
| public | updateTopicApi() | Update a topic with raw data for the API. | 329 |
| public | removeTopicApi() | Delete a topic and its relationships for the API. | 340 |
__construct()
public function __construct(TopicDao $topicDao, FormValidator $validator, Sanitize $sanitizer)
lines 81–86 (6)
| Parameter | Type | Default | Description |
|---|---|---|---|
$topicDao | ''TopicDao'' | required | none |
$validator | ''FormValidator'' | required | none |
$sanitizer | ''Sanitize'' | required | none |
setTopicId()
public function setTopicId($topic_id)
lines 94–97 (4)
setTopicId
| Parameter | Type | Default | Description |
|---|---|---|---|
$topic_id | (untyped) | required | none |
Returns: (none declared)
setTopicTitle()
public function setTopicTitle($topic_title)
lines 105–108 (4)
setTopicTitle
| Parameter | Type | Default | Description |
|---|---|---|---|
$topic_title | (untyped) | required | none |
Returns: (none declared)
setTopicSlug()
public function setTopicSlug($topic_slug)
lines 116–119 (4)
setTopicSlug
| Parameter | Type | Default | Description |
|---|---|---|---|
$topic_slug | (untyped) | required | none |
Returns: (none declared)
setTopicStatus()
public function setTopicStatus($topic_status)
lines 127–130 (4)
setTopicStatus
| Parameter | Type | Default | Description |
|---|---|---|---|
$topic_status | (untyped) | required | none |
Returns: (none declared)
setTopicLocale()
public function setTopicLocale($topic_locale)
lines 138–141 (4)
setTopicLocale
| Parameter | Type | Default | Description |
|---|---|---|---|
$topic_locale | (untyped) | required | none |
Returns: (none declared)
grabTopics()
public function grabTopics($orderBy = 'ID')
lines 149–152 (4)
grabTopics
| Parameter | Type | Default | Description |
|---|---|---|---|
$orderBy | (untyped) | 'ID' | none |
Returns: (none declared)
grabTopic()
public function grabTopic($id)
lines 160–163 (4)
grabTopic
| Parameter | Type | Default | Description |
|---|---|---|---|
$id | (untyped) | required | none |
Returns: (none declared)
getActiveTopicsApi()
public function getActiveTopicsApi($page = 1, $perPage = 10, $sortBy = 'ID', $sortOrder = 'DESC')
lines 174–178 (5)
Get paginated active topics for API
| Parameter | Type | Default | Description |
|---|---|---|---|
$page | (untyped) | 1 | none |
$perPage | (untyped) | 10 | none |
$sortBy | (untyped) | 'ID' | none |
$sortOrder | (untyped) | 'DESC' | none |
Returns: (none declared) — array
countActiveTopicsApi()
public function countActiveTopicsApi()
lines 185–188 (4)
Count active topics for API
Takes no parameters.
Returns: (none declared) — integer
getTopicApi()
public function getTopicApi($topicId)
lines 196–199 (4)
Get a single topic with post count for API
| Parameter | Type | Default | Description |
|---|---|---|---|
$topicId | (untyped) | required | none |
Returns: (none declared) — array|false
getPostsByTopicApi()
public function getPostsByTopicApi($topicId, $page = 1, $perPage = 10, $sortBy = 'ID', $sortOrder = 'DESC')
lines 211–215 (5)
Get paginated posts by topic for API
| Parameter | Type | Default | Description |
|---|---|---|---|
$topicId | (untyped) | required | none |
$page | (untyped) | 1 | none |
$perPage | (untyped) | 10 | none |
$sortBy | (untyped) | 'ID' | none |
$sortOrder | (untyped) | 'DESC' | none |
Returns: (none declared) — array
countPostsByTopicApi()
public function countPostsByTopicApi($topicId)
lines 223–226 (4)
Count published posts by topic for API
| Parameter | Type | Default | Description |
|---|---|---|---|
$topicId | (untyped) | required | none |
Returns: (none declared) — integer
addTopic()
public function addTopic()
lines 232–241 (10)
addTopic
Takes no parameters.
Returns: (none declared)
modifyTopic()
public function modifyTopic()
lines 247–258 (12)
modifyTopic
Takes no parameters.
Returns: (none declared)
removeTopic()
public function removeTopic()
lines 264–275 (12)
removeTopic
Takes no parameters.
Returns: (none declared)
totalTopics()
public function totalTopics(array $data = []): ?int
lines 283–286 (4)
totalTopics
| Parameter | Type | Default | Description |
|---|---|---|---|
$data | array | [] | none |
Returns: ?int — integer|numeric|null
localeDropDown()
public function localeDropDown($selected = "")
lines 295–298 (4)
localeDropDown
| Parameter | Type | Default | Description |
|---|---|---|---|
$selected | (untyped) | “” | none |
Returns: (none declared) — string
checkTopicSlugExists()
public function checkTopicSlugExists($slug)
lines 306–309 (4)
Check if a topic slug already exists.
| Parameter | Type | Default | Description |
|---|---|---|---|
$slug | (untyped) | required | none |
Returns: (none declared) — bool
createTopicApi()
public function createTopicApi(array $data)
lines 317–320 (4)
Create a topic from raw data for the API.
| Parameter | Type | Default | Description |
|---|---|---|---|
$data | array | required | none |
Returns: (none declared) — int
updateTopicApi()
public function updateTopicApi($topicId, array $data)
lines 329–332 (4)
Update a topic with raw data for the API.
| Parameter | Type | Default | Description |
|---|---|---|---|
$topicId | (untyped) | required | none |
$data | array | required | none |
Returns: (none declared) — void
removeTopicApi()
public function removeTopicApi($topicId)
lines 340–343 (4)
Delete a topic and its relationships for the API.
| Parameter | Type | Default | Description |
|---|---|---|---|
$topicId | (untyped) | required | none |
Returns: (none declared) — void
Imports
| Alias | Fully-qualified name |
|---|---|
FormValidator | ''Scriptlog\Core\FormValidator'' |
Sanitize | ''Scriptlog\Core\Sanitize'' |
TopicDao | ''Scriptlog\Dao\TopicDao'' |
This page is generated from source by 'tools/gendoc'. Edits will be overwritten.
