ZMObject
└─ZMZenCartDatabase
public class ZMZenCartDatabase
extends ZMObject
| Fields inherited from org.zenmagick.core.ZMObject | |
|---|---|
| properties_ | |
| Constructor Summary | |
|---|---|
ZMZenCartDatabase(array conf) Create a new instance. |
|
| Method Summary | |
|---|---|
| void | {@inheritDoc} |
| protected string | bindObject(string sql, mixed obj) 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 | {@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 | {@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 | |
|---|---|
| attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton | |
public ZMZenCartDatabase(array conf)
Create a new instance.
Since this is just a wrapper around the existing global $db, the parameters
in $conf are ignored.
public void beginTransaction()
protected string bindObject(string sql, mixed obj)
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:
:'getXXX() method excl the get prefix;' as separatorExamples:
:firstName;string - maps to the getFirstName() method; data type string:dob;date - maps to the getDob() method; data type date:newsletterSubscriber;integer - maps to the isNewsletterSubscriber() method; data type integerprotected 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.
$bindName replaced with a properly formatted value list.public void commit()
public void createModel(mixed table, mixed model, mixed mapping)
public void getConfig()
protected long getExecutionTime(string start)
Get the elapsed time since $start.
public static string getMappedType(string type)
Optional mappings.
Allows to use types not supported bb zen-cart, for example boolean.
public void getMetaData(mixed table)
public void getResource()
public void getStats()
public void loadModel(mixed table, mixed key, mixed modelClass, mixed mapping)
public void query(mixed sql, mixed args, mixed modelClass)
public void querySingle(mixed sql, mixed args, mixed modelClass)
public void removeModel(mixed table, mixed model, mixed mapping)
public void rollback()
protected array translateRow(array row, array mapping)
Translate a given raw database row with the given mapping.
null).public void update(mixed sql, mixed data)
public void updateModel(mixed table, mixed model, mixed mapping)
Implementation of the ZenMagick database layer using zen-cart's
$db.