ZenMagick 0.9.10


zenmagick.store.shared.provider\ZMZenCartDatabase
provider\ZMZenCartDatabase.php at line 33

Class ZMZenCartDatabase

ZMObject
└─ZMZenCartDatabase
All Implemented Interfaces:
org.zenmagick.core.services.database\ZMDatabase

public class ZMZenCartDatabase
extends ZMObject

Implementation of the ZenMagick database layer using zen-cart's $db.

Author:
DerManoMann

Fields inherited from org.zenmagick.core\ZMObject
properties_
Method Summary
void

__construct(array conf)

Create a new instance.

void

beginTransaction()

{@inheritDoc}

protected string

bindObject(string sql, mixed obj, array mapping)

Bind object to a given SQL query.

protected string

bindValueList(string sql, string bindName, array values, string type)

Bind a list of values to a given SQL query.

void

commit()

{@inheritDoc}

void

createModel(mixed table, mixed model, mixed mapping)

{@inheritDoc}

void

getConfig()

{@inheritDoc}

protected long

getExecutionTime(string start)

Get the elapsed time since $start.

static string

getMappedType(string type)

Optional mappings.

void

getMetaData(mixed table)

{@inheritDoc}

void

getResource()

{@inheritDoc}

void

getStats()

{@inheritDoc}

void

loadModel(mixed table, mixed key, mixed modelClass, mixed mapping)

{@inheritDoc}

void

query(mixed sql, mixed args, mixed modelClass)

{@inheritDoc}

void

querySingle(mixed sql, mixed args, mixed modelClass)

{@inheritDoc}

void

removeModel(mixed table, mixed model, mixed mapping)

{@inheritDoc}

void

rollback()

{@inheritDoc}

protected array

translateRow(array row, array mapping)

Translate a given raw database row with the given mapping.

void

update(mixed sql, mixed data)

{@inheritDoc}

void

updateModel(mixed table, mixed model, mixed mapping)

{@inheritDoc}

Methods inherited from org.zenmagick.core\ZMObject
__construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton

Method Detail

provider\ZMZenCartDatabase.php at line 50

__construct

public void __construct(array conf)

Create a new instance.

Since this is just a wrapper around the existing global $db, the parameters in $conf are ignored.

Parameters:
conf - Configuration properties.

provider\ZMZenCartDatabase.php at line 90

beginTransaction

public void beginTransaction()


provider\ZMZenCartDatabase.php at line 520

bindObject

protected string bindObject(string sql, mixed obj, array mapping)

Bind object to a given SQL query.

This is based on introspection/reflection on the given object and the available getXXX() or isXXX() methods.

SQL label must follow the listed convenctions:

Examples:

Parameters:
sql - The sql to work on.
obj - The data object instance.
mapping - Optional mapping; default is null.
Returns:
The updated SQL query.

provider\ZMZenCartDatabase.php at line 568

bindValueList

protected string bindValueList(string sql, string bindName, array values, string type)

Bind a list of values to a given SQL query.

Converts the values in the given array into a comma separated list of the specified type.

Parameters:
sql - The sql query to work on.
bindName - The name to bind the list to.
values - An array of values.
type - The value type; default is 'string'
Returns:
The sql with $bindName replaced with a properly formatted value list.

provider\ZMZenCartDatabase.php at line 96

commit

public void commit()


provider\ZMZenCartDatabase.php at line 189

createModel

public void createModel(mixed table, mixed model, mixed mapping)


provider\ZMZenCartDatabase.php at line 83

getConfig

public void getConfig()


provider\ZMZenCartDatabase.php at line 126

getExecutionTime

protected long getExecutionTime(string start)

Get the elapsed time since $start.

Parameters:
start - The starting time.
Returns:
The time in milliseconds.

provider\ZMZenCartDatabase.php at line 140

getMappedType

public static string getMappedType(string type)

Optional mappings.

Allows to use types not supported bb zen-cart, for example boolean.

Parameters:
type - The type.
Returns:
A valid zen-cart data type.

provider\ZMZenCartDatabase.php at line 417

getMetaData

public void getMetaData(mixed table)


provider\ZMZenCartDatabase.php at line 456

getResource

public void getResource()


provider\ZMZenCartDatabase.php at line 108

getStats

public void getStats()


provider\ZMZenCartDatabase.php at line 150

loadModel

public void loadModel(mixed table, mixed key, mixed modelClass, mixed mapping)


provider\ZMZenCartDatabase.php at line 373

query

public void query(mixed sql, mixed args, mixed modelClass)


provider\ZMZenCartDatabase.php at line 365

querySingle

public void querySingle(mixed sql, mixed args, mixed modelClass)


provider\ZMZenCartDatabase.php at line 323

removeModel

public void removeModel(mixed table, mixed model, mixed mapping)


provider\ZMZenCartDatabase.php at line 102

rollback

public void rollback()


provider\ZMZenCartDatabase.php at line 467

translateRow

protected array translateRow(array row, array mapping)

Translate a given raw database row with the given mapping.

Parameters:
row - The database row map.
mapping - The mapping (may be null).
Returns:
The mapped row.

provider\ZMZenCartDatabase.php at line 238

update

public void update(mixed sql, mixed data)


provider\ZMZenCartDatabase.php at line 274

updateModel

public void updateModel(mixed table, mixed model, mixed mapping)


ZenMagick 0.9.10