Aplus Framework Docs

PresenterInterface
in

Interface PresenterInterface.

The interface for data management via a Web Browser UI using the HTTP GET and POST methods.

Note: If a presenter needs more than one parameter to get URL path information provided by placeholders, in addition to $id, do not implement this interface. But this interface can be a reference because its method names are used in RouteCollection::presenter().

Tags
see
https://developer.mozilla.org/en-US/docs/Glossary/UI

Table of Contents

create()  : mixed
Handles a POST request for /.
delete()  : mixed
Handles a POST request for /$id/delete.
edit()  : mixed
Handles a GET request for /$id/edit.
index()  : mixed
Handles a GET request for /.
new()  : mixed
Handles a GET request for /new.
remove()  : mixed
Handles a GET request for /$id/remove.
show()  : mixed
Handles a GET request for /$id.
update()  : mixed
Handles a POST request for /$id/update.

Methods

delete()

Handles a POST request for /$id/delete.

public delete(string $id) : mixed

Common usage: Try to delete an item based on the $id. On success, go to the 'index' method URL and show a success message. On fail, back to the 'remove' method URL and show the error message.

Parameters
$id : string
Tags
see
PresenterInterface::index()
see
PresenterInterface::remove()
see
Method::POST
see
Response::redirect()
Return values
mixed

edit()

Handles a GET request for /$id/edit.

public edit(string $id) : mixed

Common usage: Show a form to edit a specific item based on the $id. The POST action must go to the 'update' method URL.

Parameters
$id : string
Tags
see
PresenterInterface::update()
see
Method::GET
Return values
mixed

index()

Handles a GET request for /.

public index() : mixed

Common usage: Show a list of paginated items.

Tags
see
Method::GET
Return values
mixed

new()

Handles a GET request for /new.

public new() : mixed

Common usage: Show a form with inputs to create a new item. The POST action must go to the 'create' method URL.

Tags
see
PresenterInterface::create()
see
Method::GET
Return values
mixed

remove()

Handles a GET request for /$id/remove.

public remove(string $id) : mixed

Common usage: Show an alert message about the item to be deleted based on the $id. The confirmation action must call a POST request to the 'delete' method URL.

Parameters
$id : string
Tags
see
PresenterInterface::delete()
see
Method::GET
Return values
mixed

show()

Handles a GET request for /$id.

public show(string $id) : mixed

Common usage: Show a specific item based on the $id.

Parameters
$id : string
Tags
see
Method::GET
see
Status::NOT_FOUND
Return values
mixed

update()

Handles a POST request for /$id/update.

public update(string $id) : mixed

Common usage: Try to update an item based on the $id. After the process, back to the 'edit' method URL and show a message.

Parameters
$id : string
Tags
see
PresenterInterface::edit()
see
Method::POST
see
Response::redirect()
Return values
mixed

Search results