Documentation

CommentsController extends AppController
in package

Comments Controller Manages user reviews and comments on roadtrips or points of interest.

Table of Contents

Properties

$Comments  : CommentsTable

Methods

add()  : Response|null
Add method Creates a new comment and binds it securely to the current user.
beforeRender()  : mixed
delete()  : Response|null
Delete method Deletes a comment owned by the user.
edit()  : Response|null|void
Edit method Modifies an existing comment owned by the user.
index()  : Response|null|void
Index method Lists comments. Admins see all, regular users see only theirs.
initialize()  : void
Initialization hook method.
view()  : Response|null|void
View method Displays a specific comment.

Properties

Methods

add()

Add method Creates a new comment and binds it securely to the current user.

public add() : Response|null
Return values
Response|null

Redirects on successful add.

beforeRender()

public beforeRender(EventInterface $event) : mixed
Parameters
$event : EventInterface

delete()

Delete method Deletes a comment owned by the user.

public delete([string|null $id = null ]) : Response|null
Parameters
$id : string|null = null

Comment id.

Tags
throws
RecordNotFoundException

When record not found.

Return values
Response|null

Redirects to index.

edit()

Edit method Modifies an existing comment owned by the user.

public edit([string|null $id = null ]) : Response|null|void
Parameters
$id : string|null = null

Comment id.

Tags
throws
RecordNotFoundException

When record not found.

Return values
Response|null|void

Redirects on successful edit, renders view otherwise.

index()

Index method Lists comments. Admins see all, regular users see only theirs.

public index() : Response|null|void
Return values
Response|null|void

Renders view

initialize()

Initialization hook method.

public initialize() : void

Use this method to add common initialization code like loading components.

e.g. $this->loadComponent('FormProtection');

view()

View method Displays a specific comment.

public view([string|null $id = null ]) : Response|null|void
Parameters
$id : string|null = null

Comment id.

Tags
throws
RecordNotFoundException

When record not found or not owned by user.

Return values
Response|null|void

Renders view


        
On this page

Search results