Wikimedia SlimApp
Common classes to help with creating an application using the Slim micro framework and Twig template engine.
Loading...
Searching...
No Matches
Wikimedia\Slimapp\Controller Class Reference

Page controller. More...

Public Member Functions

 __construct (Slim $slim=null)
 
 setDao (AbstractDao $dao)
 Set default DAO.
 
 setForm (Form $form)
 Set default form.
 
 setMailer (Mailer $mailer)
 Set mailer.
 
 setI18nContext (I18nContext $i18nctx)
 Set i18n context.
 
 __invoke ()
 Handle request by calling handleMethod on self.
 
 __call ( $name, $args)
 Handle calls to undefined methods by proxying to the Slim member.
 
 __get ( $name)
 Handle access to undefined member variables by proxying to the Slim member.
 

Protected Member Functions

 handle ()
 Default request handler.
 
 flashGet ( $key)
 Get a flash message.
 
 msg ( $key, $params=[])
 Get a message from the I18nContext.
 
 pagination ( $total, $current, $pageSize, $around=4)
 Compute pagination data.
 

Protected Attributes

 $slim
 
 $dao
 
 $form
 
 $mailer
 
 $i18nctx
 

Detailed Description

Page controller.

Author
Bryan Davis bd808.nosp@m.@wik.nosp@m.imedi.nosp@m.a.or.nosp@m.g

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Slimapp\Controller::__construct ( Slim $slim = null)
Parameters
Slim | null$slim

Member Function Documentation

◆ __call()

Wikimedia\Slimapp\Controller::__call ( $name,
$args )

Handle calls to undefined methods by proxying to the Slim member.

Parameters
string$nameMethod name
array$argsCall arguments
Returns
mixed

◆ __get()

Wikimedia\Slimapp\Controller::__get ( $name)

Handle access to undefined member variables by proxying to the Slim member.

Parameters
string$nameMember name
Returns
mixed

◆ __invoke()

Wikimedia\Slimapp\Controller::__invoke ( )

Handle request by calling handleMethod on self.

If no method matching the current request method is present then fall back to self::handle().

◆ flashGet()

Wikimedia\Slimapp\Controller::flashGet ( $key)
protected

Get a flash message.

Parameters
string$keyMessage key
Returns
mixed|null

◆ handle()

Wikimedia\Slimapp\Controller::handle ( )
protected

Default request handler.

Default implementation will pass()

◆ msg()

Wikimedia\Slimapp\Controller::msg ( $key,
$params = [] )
protected

Get a message from the I18nContext.

Parameters
string$keyMessage name
array$paramsParameters to add to the message
Returns
Message

◆ pagination()

Wikimedia\Slimapp\Controller::pagination ( $total,
$current,
$pageSize,
$around = 4 )
protected

Compute pagination data.

Parameters
int$totalTotal records
int$currentCurrent page number (0-indexed)
int$pageSizeNumber of items per page
int$aroundNumber of pages to show on each side of current
Returns
array Page count, first page index, last page index

◆ setDao()

Wikimedia\Slimapp\Controller::setDao ( AbstractDao $dao)

Set default DAO.

Parameters
AbstractDao$dao

◆ setForm()

Wikimedia\Slimapp\Controller::setForm ( Form $form)

Set default form.

Parameters
Form$form

◆ setI18nContext()

Wikimedia\Slimapp\Controller::setI18nContext ( I18nContext $i18nctx)

Set i18n context.

Parameters
I18nContext$i18nctx

◆ setMailer()

Wikimedia\Slimapp\Controller::setMailer ( Mailer $mailer)

Set mailer.

Parameters
Mailer$mailer

The documentation for this class was generated from the following file: