Overview

Namespaces

  • Core
    • Auth
    • Exceptions
    • Helpers
    • Providers
  • Kernel
    • Dispatch
    • Providers
  • None
  • Vendor
    • ExampleVendor

Classes

  • AbstractClass
  • ErrorController
  • Language
  • ParentController
  • ParentModel
  • Overview
  • Namespace
  • Class
  • Download

Class ParentModel

Class ParentModel connects to the database and provides useful functions (query, queryIndexed, updateRow, getRow). See each one for more details.

Direct known subclasses

Core\Auth\PasswordModel, Core\Providers\Service, Model

Indirect known subclasses

HomeModel, LoginModel, Vendor\ExampleVendor\ExampleVendorModel
Namespace: Core
Author: Nico Kupfer nico.kupfer@mamasu.es
Located at app/models/ParentModel.php
Methods summary
public static Core\ParentModel
# singleton( )

Returns the class instance, creating it if it did not exist.

Returns the class instance, creating it if it did not exist.

Returns

Core\ParentModel
public PDO
# query( string $query, array $params = array(), boolean $fetchAll = FALSE )

Runs a given $query string and returns the PDO object.

Runs a given $query string and returns the PDO object.

Parameters

$query
$params
= array()
$fetchAll
= FALSE perform a fetchAll(PDO::FETCH_ASSOC) or simply return the PDO object

Returns

PDO
public PDO
# queryClass( string $query, array $params, string $className )

Runs a given $query string and returns the instance of the $className.

Runs a given $query string and returns the instance of the $className.

Parameters

$query
$params
$className

Returns

PDO
public PDO
# queryIndexed( string $query, array $params = array(), boolean $unique = TRUE )

Runs a given $query string and returns the PDO object or the fetched results, indexed by the first column.

Runs a given $query string and returns the PDO object or the fetched results, indexed by the first column.

Parameters

$query
$params
$unique
= TRUE. If set to FALSE, each key will contain an array of values.

Returns

PDO
public array
# getRow( string $tableName, string $columnValue, string $columnName = 'id' )

Gets a single result from a given table name and a given column name

Gets a single result from a given table name and a given column name

Parameters

$tableName
$columnValue
$columnName
= 'id'

Returns

array
with the fetched row
public integer
# updateRow( string $tableName, string $columnName, integer $id, mixed $value )

Updates a given row of a given table to a given value

Updates a given row of a given table to a given value

Parameters

$tableName
Name of the table to update
$columnName
Name of the column to update
$id
The ID to index results
$value
The value to set

Returns

integer
The number of affected rows (1 or 0)
Properties summary
protected PDO $db

The database object.

The database object.

#
protected Core\Providers\Config $config

The instance of the Config class.

The instance of the Config class.

#
protected string $id

The project ID. Set from /app/config/config.ini.

The project ID. Set from /app/config/config.ini.

# __ID__
Ribosome API documentation generated by ApiGen