Vaskovsky Web Application  3.17.0306
Public Member Functions | Protected Member Functions | List of all members
AVaskovsky\WebApplication\CatalogPage Class Reference

Catalog page pattern. More...

Inheritance diagram for AVaskovsky\WebApplication\CatalogPage:
Inheritance graph
[legend]
Collaboration diagram for AVaskovsky\WebApplication\CatalogPage:
Collaboration graph
[legend]

Public Member Functions

 doSelect ()
 The SELECT action. More...
 
 doGet ()
 The GET action. More...
 
 doAdd ()
 The ADD action. More...
 
 doInsert ()
 The INSERT action. More...
 
 doUpdate ()
 The UPDATE action. More...
 
 doDelete ()
 The DELETE action. More...
 
- Public Member Functions inherited from AVaskovsky\WebApplication\AbstractPage
 getClass ()
 Returns new \ReflectionClass($this).
 
 getPageName ()
 Returns short class name without 'Page' suffix.
 
 show ()
 Handles a server request and displays this page.
 

Protected Member Functions

 create ()
 Returns an associative array that contains an initial model data; never null.
 
 sanitize ($x)
 Sanitizes a model data. More...
 
 validateUpdate ($x)
 Validates a model data to update model. More...
 
 validateInsert ($x)
 Validates a model data to insert model. More...
 
 validateKey ($x)
 Validates primary key in a model. More...
 
 select ($x)
 Returns an iterable list of objects that contains the selected models; never null. More...
 
 get ($x)
 Returns an object that contains the model data or null if the model with the specified key is not found. More...
 
 insert ($x)
 Inserts a new model in the database. More...
 
 update ($x)
 Updates a model in the database. More...
 
 delete ($x)
 Deletes a model from the database. More...
 
- Protected Member Functions inherited from AVaskovsky\WebApplication\AbstractPage
 setApplicationURL ($url)
 Sets the application URL. More...
 
 getApplicationURL ($path)
 Returns a path relative to the application URL. More...
 
 setApplicationDirectory ($directory)
 Sets the application directory. More...
 
 getApplicationFile ($filename)
 Returns a file path relative to the application directory. More...
 
 setLocale ($locale)
 Sets a locale to use with this page. More...
 
 openPDO ($dsn, $user="", $password="")
 Opens a database connection to use in this application. More...
 
 getPDO ()
 Returns a PDO connection. More...
 
 setAuthentication (AbstractAuthentication $auth)
 Sets an authentication to use with this page. More...
 
 getAuthentication ()
 Returns an AbstractAuthentication object; never null. More...
 
 authorize ()
 Performs authorization. More...
 
 authorizeByAttribute ($attribute)
 Performs authorization by the account attribute. More...
 
 authorizeByPageName (array $public_pages=array())
 Performs authorization by the page name. More...
 
 render ($template, array $view_data=array(), $code=200)
 Renders a view. More...
 
 renderError ($message, $code=500)
 Renders an error. More...
 
 renderException (\Exception $ex)
 Renders an exception. More...
 

Detailed Description

Catalog page pattern.

Author
Alexey Vaskovsky

Member Function Documentation

delete (   $x)
protected

Deletes a model from the database.

Parameters
object$xis an object that contains a sanitized model data with the valid primary key; never null.
doAdd ( )

The ADD action.

Returns
a string; never null.

Definition at line 237 of file CatalogPage.php.

doDelete ( )

The DELETE action.

Returns
a string; never null.

Definition at line 278 of file CatalogPage.php.

doGet ( )

The GET action.

Returns
a string; never null.

Definition at line 214 of file CatalogPage.php.

doInsert ( )

The INSERT action.

Returns
a string; never null.

Definition at line 255 of file CatalogPage.php.

doSelect ( )

The SELECT action.

Returns
a string; never null.

Definition at line 201 of file CatalogPage.php.

doUpdate ( )

The UPDATE action.

Returns
a string; never null.

Definition at line 265 of file CatalogPage.php.

get (   $x)
protected

Returns an object that contains the model data or null if the model with the specified key is not found.

Parameters
object$xis an object that contains a sanitized model data with the valid primary key; never null.
insert (   $x)
protected

Inserts a new model in the database.

Parameters
object$xis an object that contains a valid model data; never null.
sanitize (   $x)
protected

Sanitizes a model data.

Parameters
object$xis an object that contains a model data; never null.
Returns
an associative array that contains the sanitized data; never null.
select (   $x)
protected

Returns an iterable list of objects that contains the selected models; never null.

Parameters
object$xis an object that contains a sanitized model data; never null.
update (   $x)
protected

Updates a model in the database.

Parameters
object$xis an object that contains a valid model data; never null.
validateInsert (   $x)
protected

Validates a model data to insert model.

The default implementation uses $this->validateUpdate($x).

Parameters
object$xis an object that contains a sanitized model data; never null.
Returns
a string that contains a validation error or nothing if the model is valid.

Definition at line 187 of file CatalogPage.php.

validateKey (   $x)
protected

Validates primary key in a model.

Parameters
object$xis an object that contains a sanitized model data; never null.
Returns
a string that contains a validation error or nothing if the model is valid.

Definition at line 191 of file CatalogPage.php.

validateUpdate (   $x)
protected

Validates a model data to update model.

Parameters
object$xis an object that contains a sanitized model data; never null.
Returns
a string that contains a validation error or nothing if the model is valid.

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