| Next revision | Previous revision |
| scriptlog:lib:controller:postsapicontroller [2026/09/26 09:09] – admin admin | scriptlog:lib:controller:postsapicontroller [2026/09/26 09:34] (current) – admin admin |
|---|
| ======= Docblock Metadata ======= | ======= Docblock Metadata ======= |
| |
| ^ Tag ^ Value ^ | ^ Tag ^ Value ^ |
| | ''@category'' | Controller Class | | | ''@category'' | Controller Class | |
| | ''@author'' | Blogware Team | | | ''@author'' | Blogware Team | |
| | ''@license'' | MIT | | | ''@license'' | MIT | |
| | ''@version'' | 1.0 | | | ''@version'' | 1.0 | |
| | ''@since'' | Since Release 1.0 | | | ''@since'' | Since Release 1.0 | |
| |
| ======= Inheritance ======= | ======= Inheritance ======= |
| |
| ^ Relation ^ Type ^ Meaning ^ | ^ Relation ^ Type ^ Meaning ^ |
| | extends | [[scriptlog:lib:controller:apicontroller|''ApiController'']] | parent class/interface | | | extends | [[scriptlog:lib:controller:apicontroller|''ApiController'']] | parent class/interface | |
| |
| ======= Constants (0) ======= | ======= Constants (0) ======= |
| //None.// | //None.// |
| |
| ======= Properties (0) ======= | ======= Properties (7) ======= |
| |
| //None declared.// | ^ Visibility ^ Type ^ Name ^ Default ^ Line ^ |
| | | ''private'' | ''(untyped)'' | ''$postDao'' | | 39 | |
| | | ''private'' | ''(untyped)'' | ''$postService'' | | 44 | |
| | | ''private'' | ''(untyped)'' | ''$topicDao'' | | 49 | |
| | | ''private'' | ''(untyped)'' | ''$commentDao'' | | 54 | |
| | | ''private'' | ''(untyped)'' | ''$mediaDao'' | | 59 | |
| | | ''private'' | ''(untyped)'' | ''$sanitizer'' | | 64 | |
| | | ''private'' | ''(untyped)'' | ''$hateoas'' | | 69 | |
| |
| ======= Methods (9) ======= | ======= Methods (9) ======= |
| |
| ^ Visibility ^ Method ^ Summary ^ Line ^ | ^ Visibility ^ Method ^ Summary ^ Line ^ |
| | public | ''__construct()'' | Constructor | 83 | | | public | ''__construct()'' | Constructor | 83 | |
| | private | ''resolve()'' | Resolve an optional constructor dependency. | 106 | | | private | ''resolve()'' | Resolve an optional constructor dependency. | 106 | |
| | public | ''index()'' | Get all published posts (public endpoint) | 123 | | | public | ''index()'' | Get all published posts (public endpoint) | 123 | |
| | public | ''show()'' | Get a single post by ID (public endpoint) | 176 | | | public | ''show()'' | Get a single post by ID (public endpoint) | 176 | |
| | public | ''comments()'' | Get comments for a post (public endpoint) | 237 | | | public | ''comments()'' | Get comments for a post (public endpoint) | 237 | |
| | public | ''store()'' | Create a new post (requires authentication) | 289 | | | public | ''store()'' | Create a new post (requires authentication) | 289 | |
| | public | ''update()'' | Update an existing post (requires authentication) | 349 | | | public | ''update()'' | Update an existing post (requires authentication) | 349 | |
| | public | ''destroy()'' | Delete a post (requires authentication) | 430 | | | public | ''destroy()'' | Delete a post (requires authentication) | 430 | |
| | private | ''generateSlug()'' | Generate URL-friendly slug | 472 | | | private | ''generateSlug()'' | Generate URL-friendly slug | 472 | |
| |
| |
| controller with no arguments; tests pass mocks instead. | controller with no arguments; tests pass mocks instead. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$postDao'' | [[scriptlog:lib:dao:postdao|''?PostDao'']] | ''null'' | Data access for posts | | | ''$postDao'' | [[scriptlog:lib:dao:postdao|''?PostDao'']] | ''null'' | Data access for posts | |
| | ''$topicDao'' | [[scriptlog:lib:dao:topicdao|''?TopicDao'']] | ''null'' | Data access for topics | | | ''$topicDao'' | [[scriptlog:lib:dao:topicdao|''?TopicDao'']] | ''null'' | Data access for topics | |
| | ''$commentDao'' | [[scriptlog:lib:dao:commentdao|''?CommentDao'']] | ''null'' | Data access for comments | | | ''$commentDao'' | [[scriptlog:lib:dao:commentdao|''?CommentDao'']] | ''null'' | Data access for comments | |
| | ''$mediaDao'' | [[scriptlog:lib:dao:mediadao|''?MediaDao'']] | ''null'' | Data access for media | | | ''$mediaDao'' | [[scriptlog:lib:dao:mediadao|''?MediaDao'']] | ''null'' | Data access for media | |
| | ''$sanitizer'' | [[scriptlog:lib:core:sanitize|''?Sanitize'']] | ''null'' | Input sanitizer | | | ''$sanitizer'' | [[scriptlog:lib:core:sanitize|''?Sanitize'']] | ''null'' | Input sanitizer | |
| |
| |
| Resolve an optional constructor dependency. | Resolve an optional constructor dependency. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$provided'' | ''(untyped)'' | //required// | Injected instance or null | | | ''$provided'' | ''(untyped)'' | //required// | Injected instance or null | |
| | ''$class'' | ''(untyped)'' | //required// | Fallback class name | | | ''$class'' | ''(untyped)'' | //required// | Fallback class name | |
| |
| **Returns:** ''(none declared)'' — object | **Returns:** ''(none declared)'' — object |
| GET /api/v1/posts | GET /api/v1/posts |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$params'' | ''(untyped)'' | ''[]'' | Query parameters (page, per_page, sort_by, sort_order) | | | ''$params'' | ''(untyped)'' | ''[]'' | Query parameters (page, per_page, sort_by, sort_order) | |
| |
| **Returns:** ''(none declared)'' — void | **Returns:** ''(none declared)'' — void |
| GET /api/v1/posts/{id} | GET /api/v1/posts/{id} |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$params'' | ''(untyped)'' | ''[]'' | Route parameters including 'id' | | | ''$params'' | ''(untyped)'' | ''[]'' | Route parameters including 'id' | |
| |
| **Returns:** ''(none declared)'' — void | **Returns:** ''(none declared)'' — void |
| GET /api/v1/posts/{id}/comments | GET /api/v1/posts/{id}/comments |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$params'' | ''(untyped)'' | ''[]'' | Route parameters including 'id' | | | ''$params'' | ''(untyped)'' | ''[]'' | Route parameters including 'id' | |
| |
| **Returns:** ''(none declared)'' — void | **Returns:** ''(none declared)'' — void |
| POST /api/v1/posts | POST /api/v1/posts |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$_params'' | ''(untyped)'' | ''[]'' | //none// | | | ''$_params'' | ''(untyped)'' | ''[]'' | //none// | |
| |
| **Returns:** ''(none declared)'' — void | **Returns:** ''(none declared)'' — void |
| PUT /api/v1/posts/{id} | PUT /api/v1/posts/{id} |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$params'' | ''(untyped)'' | ''[]'' | Route parameters including 'id' | | | ''$params'' | ''(untyped)'' | ''[]'' | Route parameters including 'id' | |
| |
| **Returns:** ''(none declared)'' — void | **Returns:** ''(none declared)'' — void |
| DELETE /api/v1/posts/{id} | DELETE /api/v1/posts/{id} |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$params'' | ''(untyped)'' | ''[]'' | Route parameters including 'id' | | | ''$params'' | ''(untyped)'' | ''[]'' | Route parameters including 'id' | |
| |
| **Returns:** ''(none declared)'' — void | **Returns:** ''(none declared)'' — void |
| Generate URL-friendly slug | Generate URL-friendly slug |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$title'' | ''(untyped)'' | //required// | //none// | | | ''$title'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — string | **Returns:** ''(none declared)'' — string |
| ======= Imports ======= | ======= Imports ======= |
| |
| ^ Alias ^ Fully-qualified name ^ | ^ Alias ^ Fully-qualified name ^ |
| | ''ApiController'' | [[scriptlog:lib:controller:apicontroller|''Scriptlog\Controller\ApiController'']] | | | ''ApiController'' | [[scriptlog:lib:controller:apicontroller|''Scriptlog\Controller\ApiController'']] | |
| | ''ApiAuth'' | [[scriptlog:lib:core:apiauth|''Scriptlog\Core\ApiAuth'']] | | | ''ApiAuth'' | [[scriptlog:lib:core:apiauth|''Scriptlog\Core\ApiAuth'']] | |
| | ''ApiHateoas'' | [[scriptlog:lib:core:apihateoas|''Scriptlog\Core\ApiHateoas'']] | | | ''ApiHateoas'' | [[scriptlog:lib:core:apihateoas|''Scriptlog\Core\ApiHateoas'']] | |
| | ''ApiResponse'' | [[scriptlog:lib:core:apiresponse|''Scriptlog\Core\ApiResponse'']] | | | ''ApiResponse'' | [[scriptlog:lib:core:apiresponse|''Scriptlog\Core\ApiResponse'']] | |
| | ''FormValidator'' | [[scriptlog:lib:core:formvalidator|''Scriptlog\Core\FormValidator'']] | | | ''FormValidator'' | [[scriptlog:lib:core:formvalidator|''Scriptlog\Core\FormValidator'']] | |
| | ''Sanitize'' | [[scriptlog:lib:core:sanitize|''Scriptlog\Core\Sanitize'']] | | | ''Sanitize'' | [[scriptlog:lib:core:sanitize|''Scriptlog\Core\Sanitize'']] | |
| | ''CommentDao'' | [[scriptlog:lib:dao:commentdao|''Scriptlog\Dao\CommentDao'']] | | | ''CommentDao'' | [[scriptlog:lib:dao:commentdao|''Scriptlog\Dao\CommentDao'']] | |
| | ''MediaDao'' | [[scriptlog:lib:dao:mediadao|''Scriptlog\Dao\MediaDao'']] | | | ''MediaDao'' | [[scriptlog:lib:dao:mediadao|''Scriptlog\Dao\MediaDao'']] | |
| | ''PostDao'' | [[scriptlog:lib:dao:postdao|''Scriptlog\Dao\PostDao'']] | | | ''PostDao'' | [[scriptlog:lib:dao:postdao|''Scriptlog\Dao\PostDao'']] | |
| | ''TopicDao'' | [[scriptlog:lib:dao:topicdao|''Scriptlog\Dao\TopicDao'']] | | | ''TopicDao'' | [[scriptlog:lib:dao:topicdao|''Scriptlog\Dao\TopicDao'']] | |
| | ''CommentApiDto'' | [[scriptlog:lib:dto:commentapidto|''Scriptlog\Dto\Api\CommentApiDto'']] | | | ''CommentApiDto'' | [[scriptlog:lib:dto:commentapidto|''Scriptlog\Dto\Api\CommentApiDto'']] | |
| | ''PostApiDto'' | [[scriptlog:lib:dto:postapidto|''Scriptlog\Dto\Api\PostApiDto'']] | | | ''PostApiDto'' | [[scriptlog:lib:dto:postapidto|''Scriptlog\Dto\Api\PostApiDto'']] | |
| | ''PostService'' | [[scriptlog:lib:service:postservice|''Scriptlog\Service\PostService'']] | | | ''PostService'' | [[scriptlog:lib:service:postservice|''Scriptlog\Service\PostService'']] | |
| |
| |