From 6890520835e4a55d7727c4ab0088322a84aeb15e Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 26 Apr 2012 16:50:41 -0400 Subject: [PATCH] Fix database --- docs/classes.svg | 228 ++-- docs/classes/DB.html | 1453 +++++++++++++++++++++++ docs/classes/DB_PDO.html | 2 +- docs/classes/DB_Reg.html | 2 +- docs/classes/DB_SQL.html | 2 +- docs/classes/DB_Util.html | 2 +- docs/classes/Firebird.html | 2 +- docs/classes/Firebird_Result.html | 2 +- docs/classes/Firebird_SQL.html | 2 +- docs/classes/Firebird_Util.html | 2 +- docs/classes/MM_Controller.html | 2 +- docs/classes/MM_Model.html | 2 +- docs/classes/MM_Output.html | 2 +- docs/classes/MM_Page.html | 2 +- docs/classes/MySQL.html | 2 +- docs/classes/MySQL_SQL.html | 2 +- docs/classes/MySQL_Util.html | 2 +- docs/classes/ODBC.html | 2 +- docs/classes/ODBC_SQL.html | 2 +- docs/classes/ODBC_Util.html | 2 +- docs/classes/PgSQL.html | 2 +- docs/classes/PgSQL_SQL.html | 2 +- docs/classes/PgSQL_Util.html | 2 +- docs/classes/Query_Builder.html | 2 +- docs/classes/R.html | 2 +- docs/classes/SQLite.html | 2 +- docs/classes/SQLite_SQL.html | 2 +- docs/classes/SQLite_Util.html | 2 +- docs/classes/Settings.html | 2 +- docs/classes/Welcome.html | 2 +- docs/classes/Welcome_Model.html | 2 +- docs/classes/miniMVC.html | 24 +- docs/deprecated.html | 2 +- docs/errors.html | 3 +- docs/graph_class.html | 2 +- docs/index.html | 2 +- docs/markers.html | 2 +- docs/namespaces/default.html | 13 +- docs/packages/.html | 2 +- docs/packages/Default.html | 2 +- docs/packages/Query.Drivers.html | 2 +- docs/packages/Query.Helper Classes.html | 2 +- docs/packages/Query.Query.html | 2 +- docs/packages/Query.html | 2 +- docs/packages/miniMVC.App.html | 2 +- docs/packages/miniMVC.System.html | 10 +- docs/packages/miniMVC.html | 13 +- docs/structure.xml | 390 ++++-- src/index.php | 11 +- src/sys/common.php | 7 +- src/sys/db.php | 222 +--- src/sys/miniMVC.php | 11 +- 52 files changed, 1985 insertions(+), 480 deletions(-) create mode 100644 docs/classes/DB.html diff --git a/docs/classes.svg b/docs/classes.svg index 782aa81..8ec4a22 100644 --- a/docs/classes.svg +++ b/docs/classes.svg @@ -36,9 +36,9 @@ \\DB_SQL - -«abstract» -DB_SQL + +«abstract» +DB_SQL @@ -50,7 +50,7 @@ -\\PDO +\\PDO \PDO @@ -62,173 +62,173 @@ \\Query_Builder - -Query_Builder + +Query_Builder \\DB_Util - -«abstract» -DB_Util + +«abstract» +DB_Util \\PgSQL_SQL - -PgSQL_SQL + +PgSQL_SQL \\PgSQL_SQL->\\DB_SQL - - + + \\PgSQL_Util - -PgSQL_Util + +PgSQL_Util \\PgSQL_Util->\\DB_Util - - + + \\PgSQL - -PgSQL + +PgSQL \\PgSQL->\\DB_PDO - - + + \\ODBC_Util - -ODBC_Util + +ODBC_Util \\ODBC_Util->\\DB_Util - - + + \\ODBC_SQL - -ODBC_SQL + +ODBC_SQL \\ODBC_SQL->\\DB_SQL - - + + \\ODBC - -ODBC + +ODBC \\ODBC->\\DB_PDO - - + + \\MySQL_Util - -MySQL_Util + +MySQL_Util \\MySQL_Util->\\DB_Util - - + + \\MySQL - -MySQL + +MySQL \\MySQL->\\DB_PDO - - + + \\MySQL_SQL - -MySQL_SQL + +MySQL_SQL \\MySQL_SQL->\\DB_SQL - - + + \\SQLite_Util - -SQLite_Util + +SQLite_Util \\SQLite_Util->\\DB_Util - - + + \\SQLite - -SQLite + +SQLite \\SQLite->\\DB_PDO - - + + \\SQLite_SQL - -SQLite_SQL + +SQLite_SQL \\SQLite_SQL->\\DB_SQL - - + + \\Firebird_SQL - -Firebird_SQL + +Firebird_SQL \\Firebird_SQL->\\DB_SQL - - + + \\Firebird_Result @@ -238,7 +238,7 @@ -\\PDOStatement +\\PDOStatement \PDOStatement @@ -250,122 +250,134 @@ \\Firebird - -Firebird + +Firebird \\Firebird->\\DB_PDO - - + + \\Firebird_Util - -Firebird_Util + +Firebird_Util \\Firebird_Util->\\DB_Util - - + + + + +\\DB + + +DB + + + +\\DB->\\Query_Builder + + -\\miniMVC +\\miniMVC - -miniMVC + +miniMVC -\\ArrayObject - -\ArrayObject +\\ArrayObject + +\ArrayObject -\\miniMVC->\\ArrayObject - - +\\miniMVC->\\ArrayObject + + -\\MM_Controller +\\MM_Controller - -MM_Controller + +MM_Controller -\\MM_Controller->\\miniMVC - - +\\MM_Controller->\\miniMVC + + -\\MM_Model +\\MM_Model - -MM_Model + +MM_Model -\\MM_Model->\\miniMVC - - +\\MM_Model->\\miniMVC + + -\\R +\\R R -\\ReflectionClass +\\ReflectionClass \ReflectionClass -\\R->\\ReflectionClass +\\R->\\ReflectionClass -\\MM_Page +\\MM_Page MM_Page -\\MM_Output +\\MM_Output MM_Output -\\Welcome_Model +\\Welcome_Model - -Welcome_Model + +Welcome_Model -\\Welcome_Model->\\MM_Model - - +\\Welcome_Model->\\MM_Model + + -\\Welcome +\\Welcome - -Welcome + +Welcome -\\Welcome->\\MM_Controller - - +\\Welcome->\\MM_Controller + + diff --git a/docs/classes/DB.html b/docs/classes/DB.html new file mode 100644 index 0000000..b1996af --- /dev/null +++ b/docs/classes/DB.html @@ -0,0 +1,1453 @@ + + + + + +miniMVC » \DB + + + + + + + + + + +
+ +
+
+
+ +
+ +
+
+
+

Extend PHP's PDO class to add some more functionality

+
+

+ + + + + + + + + +
packageminiMVC
subpackageSystem
+

+ Methods

+
+

Override __call in trait to call __call in Query Builder...lol

+
__call(string $name, array $params) : mixed
+
+
+

+

Parameters

+
+

$name

+string +
+
+

$params

+array +
+

Returns

+
mixed
+
+
+
+

PHP magic methods to call non-static methods statically

+
__callStatic(string $name, array $args) 
+
+
+

+

Parameters

+
+

$name

+string +
+
+

$args

+array +
+
+
+
+

Constructor to override PDO constructor - Quercus doesn't seem to override +the parent constructor unless the arguments match.

+
__construct(array $params) 
+
+
+

+

Parameters

+
+

$params

+array +
+
+
+
+

Retreive the number of rows in the selected table

+
count_all(string $table) : int
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::count_all()
+

Parameters

+
+

$table

+string +
+

Returns

+
int
+
+
+
+

Retrieve the number of results for the generated query - used +in place of the get() method

+
count_all_results(string $table) : int
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::count_all_results()
+

Parameters

+
+

$table

+string +
+

Returns

+
int
+
+
+
+

Deletes data from a table

+
delete(string $table, mixed $where) : mixed
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::delete()
+

Parameters

+
+

$table

+string +
+
+

$where

+mixed +
+

Returns

+
mixed
+
+
+
+

Adds the 'distinct' keyword to a query

+
distinct() : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::distinct()
fluentThis method is part of a fluent interface and will return the same instance
+

Returns

+ +
+
+
+

Specify the database table to select from

+
from(string $dbname) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::from()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$dbname

+string +
+

Returns

+ +
+
+
+

Select and retrieve all records from the current table, and/or +execute current compiled query

+
get($table, int $limit, int $offset) : object
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::get()
+

Parameters

+
+

$table

+ +
+
+

$limit

+int +
+
+

$offset

+int +
+

Returns

+
object
+
+
+
+

Indexed singleton method

+
get_instance(string $dbname, array $options) : \DB
+
+
+

+

Parameters

+
+

$dbname

+string +
+
+

$options

+array +
+

Returns

+ +
+
+
+

Returns the last error from the database

+
get_last_error() : string
+
+
+

+

Returns

+
string
+
+
+
+

Convience method for get() with a where clause

+
get_where(string $table, array $where, int $limit, int $offset) : object
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::get_where()
+

Parameters

+
+

$table

+string +
+
+

$where

+array +
+
+

$limit

+int +
+
+

$offset

+int +
+

Returns

+
object
+
+
+
+

Group the results by the selected field(s)

+
group_by(mixed $field) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::group_by()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$field

+mixed +
+

Returns

+ +
+
+
+

Ends a query group

+
group_end() : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::group_end()
fluentThis method is part of a fluent interface and will return the same instance
+

Returns

+ +
+
+
+

Adds a paren to the current query for query grouping

+
group_start() : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::group_start()
fluentThis method is part of a fluent interface and will return the same instance
+

Returns

+ +
+
+
+

Generates a 'Having' clause

+
having(mixed $key, mixed $val) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::having()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$key

+mixed +
+
+

$val

+mixed +
+

Returns

+ +
+
+
+

Creates an insert clause, and executes it

+
insert(string $table, mixed $data) : mixed
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::insert()
+

Parameters

+
+

$table

+string +
+
+

$data

+mixed +
+

Returns

+
mixed
+
+
+
+

Creates a join phrase in a compiled query

+
join(string $table, string $condition, string $type) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::join()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$table

+string +
+
+

$condition

+string +
+
+

$type

+string +
+

Returns

+ +
+
+ +
+

Set a limit on the current sql statement

+
limit(int $limit, int $offset) : string
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::limit()
+

Parameters

+
+

$limit

+int +
+
+

$offset

+int +
+

Returns

+
string
+
+
+
+

Generates a NOT LIKE clause

+
not_like(string $field, mixed $val, string $pos) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::not_like()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$field

+string +
+
+

$val

+mixed +
+
+

$pos

+string +
+

Returns

+ +
+
+
+

Adds a paren to the current query for query grouping, +prefixed with 'OR'

+
or_group_start() : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::or_group_start()
fluentThis method is part of a fluent interface and will return the same instance
+

Returns

+ +
+
+
+

Generates a 'Having' clause prefixed with 'OR'

+
or_having(mixed $key, mixed $val) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::or_having()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$key

+mixed +
+
+

$val

+mixed +
+

Returns

+ +
+
+
+

Generates an OR Like clause

+
or_like(string $field, mixed $val, string $pos) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::or_like()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$field

+string +
+
+

$val

+mixed +
+
+

$pos

+string +
+

Returns

+ +
+
+
+

Adds a paren to the current query for query grouping, +prefixed with 'OR NOT'

+
or_not_group_start() : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::or_not_group_start()
fluentThis method is part of a fluent interface and will return the same instance
+

Returns

+ +
+
+
+

Generates a OR NOT LIKE clause

+
or_not_like(string $field, mixed $val, string $pos) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::or_not_like()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$field

+string +
+
+

$val

+mixed +
+
+

$pos

+string +
+

Returns

+ +
+
+
+

Where clause prefixed with "OR"

+
or_where(string $field, mixed $val) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::or_where()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$field

+string +
+
+

$val

+mixed +
+

Returns

+ +
+
+
+

Where in statement prefixed with "or"

+
or_where_in(string $field, mixed $val) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::or_where_in()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$field

+string +
+
+

$val

+mixed +
+

Returns

+ +
+
+
+

OR WHERE NOT IN (FOO) clause

+
or_where_not_in(string $field, mixed $val) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::or_where_not_in()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$field

+string +
+
+

$val

+mixed +
+

Returns

+ +
+
+
+

Order the results by the selected field(s)

+
order_by(string $field, string $type) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::order_by()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$field

+string +
+
+

$type

+string +
+

Returns

+ +
+
+
+

Specifies rows to select in a query

+
select(string $fields) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::select()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$fields

+string +
+

Returns

+ +
+
+
+

Selects the average value of a field from a query

+
select_avg(string $field, string $as) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::select_avg()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$field

+string +
+
+

$as

+string +
+

Returns

+ +
+
+
+

Selects the maximum value of a field from a query

+
select_max(string $field, string $as) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::select_max()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$field

+string +
+
+

$as

+string +
+

Returns

+ +
+
+
+

Selects the minimum value of a field from a query

+
select_min(string $field, string $as) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::select_min()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$field

+string +
+
+

$as

+string +
+

Returns

+ +
+
+
+

Selects the sum of a field from a query

+
select_sum(string $field, string $as) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::select_sum()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$field

+string +
+
+

$as

+string +
+

Returns

+ +
+
+
+

Sets values for inserts / updates / deletes

+
set(mixed $key, mixed $val) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::set()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$key

+mixed +
+
+

$val

+mixed +
+

Returns

+ +
+
+
+

Creates an update clause, and executes it

+
update(string $table, mixed $data) : mixed
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::update()
+

Parameters

+
+

$table

+string +
+
+

$data

+mixed +
+

Returns

+
mixed
+
+
+
+

Specify condition(s) in the where clause of a query +Note: this function works with key / value, or a +passed array with key / value pairs

+
where(mixed $key, mixed $val) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::where()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$key

+mixed +
+
+

$val

+mixed +
+

Returns

+ +
+
+
+

Where clause with 'IN' statement

+
where_in(mixed $field, mixed $val) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::where_in()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$field

+mixed +
+
+

$val

+mixed +
+

Returns

+ +
+
+
+

WHERE NOT IN (FOO) clause

+
where_not_in(string $field, mixed $val) : \DB
+
Inherited
+
+

+ + + + + + + + + +
inherited_from\Query_Builder::where_not_in()
fluentThis method is part of a fluent interface and will return the same instance
+

Parameters

+
+

$field

+string +
+
+

$val

+mixed +
+

Returns

+ +
+
+
+

String together the sql statements for sending to the db

+
_compile(string $type, string $table) : \$string
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::_compile()
+

Parameters

+
+

$type

+string +
+
+

$table

+string +
+

Returns

+
\$string
+
+
+
+

Clear out the class variables, so the next query can be run

+
_reset() 
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::_reset()
+
+
+
+

Do all the repeditive stuff for where/having type methods

+
_where(mixed $key, mixed $val) : array
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::_where()
+

Parameters

+
+

$key

+mixed +
+
+

$val

+mixed +
+

Returns

+
array
+
+
+

+ Properties

+ 
+

Convenience property for connection management

+
$conn_name : string
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::$$conn_name
+
+
+ 
+

Compiled 'from' clause

+
$from_string : string
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::$$from_string
+
+
+ 
+

Key/val pairs for group by clause

+
$group_array : array
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::$$group_array
+
+
+ 
+

Group by clause

+
$group_string : string
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::$$group_string
+
+
+ 
+

Map for having clause

+
$having_map : array
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::$$having_map
+
+
+ 
+

DB connection instances

+
$instance : array
+
+

+
+ 
+

Value for limit string

+
$limit : int
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::$$limit
+
+
+ 
+

Value for offset in limit string

+
$offset : int
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::$$offset
+
+
+ 
+

Key/val pairs for order by clause

+
$order_array : array
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::$$order_array
+
+
+ 
+

Order by clause

+
$order_string : string
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::$$order_string
+
+
+ 
+

Query component order mapping +for complex select queries

+
$query_map : array
+
Inherited
+
+

Format:

+ +

array( + 'type' => 'where', + 'conjunction' => ' AND ', + 'string' => 'k=?' +)

+ + + +
inherited_from\Query_Builder::$$query_map
+
+
+ 
+

Compiled 'select' clause

+
$select_string : string
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::$$select_string
+
+
+ 
+

key/val pairs for insert/update statement

+
$set_array : array
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::$$set_array
+
+
+ 
+

Keys for insert/update statement

+
$set_array_keys : array
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::$$set_array_keys
+
+
+ 
+

Compiled arguments for insert / update

+
$set_string : string
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::$$set_string
+
+
+ 
+

Alias to $this->db->sql

+
$sql : \DB_PDO
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::$$sql
+
+
+ 
+

Values to apply to prepared statements

+
$values : array
+
Inherited
+
+

+ + + +
inherited_from\Query_Builder::$$values
+
+
+
+
+
+
+
+
+ + diff --git a/docs/classes/DB_PDO.html b/docs/classes/DB_PDO.html index a829346..03623d5 100644 --- a/docs/classes/DB_PDO.html +++ b/docs/classes/DB_PDO.html @@ -663,7 +663,7 @@ the connection/database
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/DB_Reg.html b/docs/classes/DB_Reg.html index ba417be..545e787 100644 --- a/docs/classes/DB_Reg.html +++ b/docs/classes/DB_Reg.html @@ -152,7 +152,7 @@ and organizes database connections

+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/DB_SQL.html b/docs/classes/DB_SQL.html index c53c3d9..208c9ac 100644 --- a/docs/classes/DB_SQL.html +++ b/docs/classes/DB_SQL.html @@ -269,7 +269,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/DB_Util.html b/docs/classes/DB_Util.html index 30f24e8..1eaee68 100644 --- a/docs/classes/DB_Util.html +++ b/docs/classes/DB_Util.html @@ -209,7 +209,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/Firebird.html b/docs/classes/Firebird.html index 66b084c..ead640f 100644 --- a/docs/classes/Firebird.html +++ b/docs/classes/Firebird.html @@ -813,7 +813,7 @@ the last query executed
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/Firebird_Result.html b/docs/classes/Firebird_Result.html index 1061f54..278c4e7 100644 --- a/docs/classes/Firebird_Result.html +++ b/docs/classes/Firebird_Result.html @@ -504,7 +504,7 @@ the query
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/Firebird_SQL.html b/docs/classes/Firebird_SQL.html index 0082ca9..04d6888 100644 --- a/docs/classes/Firebird_SQL.html +++ b/docs/classes/Firebird_SQL.html @@ -297,7 +297,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/Firebird_Util.html b/docs/classes/Firebird_Util.html index e138bf3..3a364bb 100644 --- a/docs/classes/Firebird_Util.html +++ b/docs/classes/Firebird_Util.html @@ -212,7 +212,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/MM_Controller.html b/docs/classes/MM_Controller.html index 9894c11..959ebd2 100644 --- a/docs/classes/MM_Controller.html +++ b/docs/classes/MM_Controller.html @@ -727,7 +727,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/MM_Model.html b/docs/classes/MM_Model.html index 5c8445a..2e3eeb0 100644 --- a/docs/classes/MM_Model.html +++ b/docs/classes/MM_Model.html @@ -685,7 +685,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/MM_Output.html b/docs/classes/MM_Output.html index 4f3099c..2d1de28 100644 --- a/docs/classes/MM_Output.html +++ b/docs/classes/MM_Output.html @@ -172,7 +172,7 @@ Used for outputing HTML
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/MM_Page.html b/docs/classes/MM_Page.html index f82d787..c174419 100644 --- a/docs/classes/MM_Page.html +++ b/docs/classes/MM_Page.html @@ -498,7 +498,7 @@ supports

+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/MySQL.html b/docs/classes/MySQL.html index 3e80bd5..df57717 100644 --- a/docs/classes/MySQL.html +++ b/docs/classes/MySQL.html @@ -849,7 +849,7 @@ the connection/database
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/MySQL_SQL.html b/docs/classes/MySQL_SQL.html index 197d8ee..794f8c5 100644 --- a/docs/classes/MySQL_SQL.html +++ b/docs/classes/MySQL_SQL.html @@ -281,7 +281,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/MySQL_Util.html b/docs/classes/MySQL_Util.html index 84aa110..582cebe 100644 --- a/docs/classes/MySQL_Util.html +++ b/docs/classes/MySQL_Util.html @@ -208,7 +208,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/ODBC.html b/docs/classes/ODBC.html index 086124f..a9994d8 100644 --- a/docs/classes/ODBC.html +++ b/docs/classes/ODBC.html @@ -851,7 +851,7 @@ the connection/database
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/ODBC_SQL.html b/docs/classes/ODBC_SQL.html index c790bb9..0372a52 100644 --- a/docs/classes/ODBC_SQL.html +++ b/docs/classes/ODBC_SQL.html @@ -281,7 +281,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/ODBC_Util.html b/docs/classes/ODBC_Util.html index 4076853..c4889d6 100644 --- a/docs/classes/ODBC_Util.html +++ b/docs/classes/ODBC_Util.html @@ -203,7 +203,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/PgSQL.html b/docs/classes/PgSQL.html index 4055332..8ed64f5 100644 --- a/docs/classes/PgSQL.html +++ b/docs/classes/PgSQL.html @@ -851,7 +851,7 @@ the connection/database
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/PgSQL_SQL.html b/docs/classes/PgSQL_SQL.html index c721c95..77da151 100644 --- a/docs/classes/PgSQL_SQL.html +++ b/docs/classes/PgSQL_SQL.html @@ -297,7 +297,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/PgSQL_Util.html b/docs/classes/PgSQL_Util.html index e03c8b8..43302ba 100644 --- a/docs/classes/PgSQL_Util.html +++ b/docs/classes/PgSQL_Util.html @@ -208,7 +208,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/Query_Builder.html b/docs/classes/Query_Builder.html index 458f6fb..6b373f9 100644 --- a/docs/classes/Query_Builder.html +++ b/docs/classes/Query_Builder.html @@ -1087,7 +1087,7 @@ for complex select queries
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/R.html b/docs/classes/R.html index 585ab30..78cd8da 100644 --- a/docs/classes/R.html +++ b/docs/classes/R.html @@ -844,7 +844,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/SQLite.html b/docs/classes/SQLite.html index 378f10f..3d7df5f 100644 --- a/docs/classes/SQLite.html +++ b/docs/classes/SQLite.html @@ -866,7 +866,7 @@ method if the database does not support 'TRUNCATE';
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/SQLite_SQL.html b/docs/classes/SQLite_SQL.html index 512a323..b77d921 100644 --- a/docs/classes/SQLite_SQL.html +++ b/docs/classes/SQLite_SQL.html @@ -281,7 +281,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/SQLite_Util.html b/docs/classes/SQLite_Util.html index f01488e..dd3c7c5 100644 --- a/docs/classes/SQLite_Util.html +++ b/docs/classes/SQLite_Util.html @@ -208,7 +208,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/Settings.html b/docs/classes/Settings.html index 88498b5..fe96ed1 100644 --- a/docs/classes/Settings.html +++ b/docs/classes/Settings.html @@ -244,7 +244,7 @@ directly - the settings should be safe!
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/Welcome.html b/docs/classes/Welcome.html index ed7d865..58f803f 100644 --- a/docs/classes/Welcome.html +++ b/docs/classes/Welcome.html @@ -900,7 +900,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/Welcome_Model.html b/docs/classes/Welcome_Model.html index 51a8f48..8f34230 100644 --- a/docs/classes/Welcome_Model.html +++ b/docs/classes/Welcome_Model.html @@ -821,7 +821,7 @@
+ generated on 2012-04-26T16:50:04-04:00.
diff --git a/docs/classes/miniMVC.html b/docs/classes/miniMVC.html index f751bf0..5f0fc69 100644 --- a/docs/classes/miniMVC.html +++ b/docs/classes/miniMVC.html @@ -59,6 +59,7 @@  Methods
  • PHP magic method to facilitate dynamic methods
    __call()
  • Magic function called when cloning an object
    __clone()
  • +
  • Constructor - Any classes loaded here become subclasses of miniMVC
    __construct()
  • PHP magic method that is called when an object is treated as a function
    __invoke()
  • append()
    append()
  • @@ -106,8 +107,6 @@
  • Convenience function to remove an object from the singleton
    unload()
  • unserialize()
    unserialize()
  • - -
  • Constructor - Any classes loaded here become subclasses of miniMVC
    __construct()
  • @@ -154,6 +153,19 @@

    +
    +

    Constructor - Any classes loaded here become subclasses of miniMVC

    +
    __construct(array $members) 
    +
    +
    +

    +

    Parameters

    +
    +

    $members

    +array +
    +
    +

    PHP magic method that is called when an object is treated as a function

    __invoke() 
    @@ -487,12 +499,6 @@
    -
    -

    Constructor - Any classes loaded here become subclasses of miniMVC

    -
    __construct() 
    -
    -

    -

     Properties

     
    @@ -508,7 +514,7 @@
    + generated on 2012-04-26T16:50:04-04:00.
    diff --git a/docs/deprecated.html b/docs/deprecated.html index 591b946..c1db6b2 100644 --- a/docs/deprecated.html +++ b/docs/deprecated.html @@ -67,7 +67,7 @@
    + generated on 2012-04-26T16:50:04-04:00.
    diff --git a/docs/errors.html b/docs/errors.html index fe175cd..3eee697 100644 --- a/docs/errors.html +++ b/docs/errors.html @@ -99,12 +99,13 @@
    +
    + generated on 2012-04-26T16:50:04-04:00.
    diff --git a/docs/graph_class.html b/docs/graph_class.html index 0a89602..e52557e 100644 --- a/docs/graph_class.html +++ b/docs/graph_class.html @@ -64,7 +64,7 @@
    + generated on 2012-04-26T16:50:04-04:00.
    diff --git a/docs/index.html b/docs/index.html index 58d5a75..cbf3944 100644 --- a/docs/index.html +++ b/docs/index.html @@ -80,7 +80,7 @@
    + generated on 2012-04-26T16:50:04-04:00.
    diff --git a/docs/markers.html b/docs/markers.html index 22edb52..ea39c2d 100644 --- a/docs/markers.html +++ b/docs/markers.html @@ -69,7 +69,7 @@
    + generated on 2012-04-26T16:50:04-04:00.
    diff --git a/docs/namespaces/default.html b/docs/namespaces/default.html index e2c03fa..dd906a2 100644 --- a/docs/namespaces/default.html +++ b/docs/namespaces/default.html @@ -74,7 +74,7 @@ Functions

    PHP magic method to facilitate dynamic methods

    -
    __call(string $name, array $args) 
    +
    __call(string $name, array $params) 

    @@ -84,7 +84,7 @@ string
    -

    $args

    +

    $params

    array
    @@ -356,6 +356,13 @@ display them cleanly

    Classes and interfaces

    +
    +

    DB +

    +

    Extend PHP's PDO class to add some more functionality

    +
    +« More » +

    DB_PDO

    @@ -702,7 +709,7 @@ instantiates the specific db driver

    + generated on 2012-04-26T16:50:04-04:00.
    diff --git a/docs/packages/.html b/docs/packages/.html index 8bf89b2..c6cf46c 100644 --- a/docs/packages/.html +++ b/docs/packages/.html @@ -67,7 +67,7 @@
    + generated on 2012-04-26T16:50:04-04:00.
    diff --git a/docs/packages/Default.html b/docs/packages/Default.html index c3eaac0..565b63c 100644 --- a/docs/packages/Default.html +++ b/docs/packages/Default.html @@ -185,7 +185,7 @@
    + generated on 2012-04-26T16:50:04-04:00.
    diff --git a/docs/packages/Query.Drivers.html b/docs/packages/Query.Drivers.html index 49eef69..067b3a8 100644 --- a/docs/packages/Query.Drivers.html +++ b/docs/packages/Query.Drivers.html @@ -211,7 +211,7 @@ data-fetching methods

    + generated on 2012-04-26T16:50:04-04:00.
    diff --git a/docs/packages/Query.Helper Classes.html b/docs/packages/Query.Helper Classes.html index e2ecebc..b4bb3c9 100644 --- a/docs/packages/Query.Helper Classes.html +++ b/docs/packages/Query.Helper Classes.html @@ -97,7 +97,7 @@
    + generated on 2012-04-26T16:50:04-04:00.
    diff --git a/docs/packages/Query.Query.html b/docs/packages/Query.Query.html index 4685a7c..25ced54 100644 --- a/docs/packages/Query.Query.html +++ b/docs/packages/Query.Query.html @@ -115,7 +115,7 @@ instantiates the specific db driver

    + generated on 2012-04-26T16:50:04-04:00.
    diff --git a/docs/packages/Query.html b/docs/packages/Query.html index 7d3e2fc..53fa6c7 100644 --- a/docs/packages/Query.html +++ b/docs/packages/Query.html @@ -316,7 +316,7 @@ instantiates the specific db driver

    + generated on 2012-04-26T16:50:04-04:00.
    diff --git a/docs/packages/miniMVC.App.html b/docs/packages/miniMVC.App.html index 580853d..384c01d 100644 --- a/docs/packages/miniMVC.App.html +++ b/docs/packages/miniMVC.App.html @@ -139,7 +139,7 @@
    + generated on 2012-04-26T16:50:04-04:00.
    diff --git a/docs/packages/miniMVC.System.html b/docs/packages/miniMVC.System.html index 9425a16..26da918 100644 --- a/docs/packages/miniMVC.System.html +++ b/docs/packages/miniMVC.System.html @@ -62,6 +62,7 @@ +
  • DB
  • miniMVC
  • MM_Controller
  • MM_Model
  • @@ -81,6 +82,13 @@

    Classes and interfaces

    +
    +

    DB +

    +

    Extend PHP's PDO class to add some more functionality

    +
    +« More » +

    MM_Controller

    @@ -129,7 +137,7 @@
    + generated on 2012-04-26T16:50:04-04:00.
    diff --git a/docs/packages/miniMVC.html b/docs/packages/miniMVC.html index ddae9a8..ba589b3 100644 --- a/docs/packages/miniMVC.html +++ b/docs/packages/miniMVC.html @@ -105,7 +105,7 @@ display them cleanly
    shutdown
    Functions

    PHP magic method to facilitate dynamic methods

    -
    __call(string $name, array $args) 
    +
    __call(string $name, array $params) 

    @@ -115,7 +115,7 @@ display them cleanly
    shutdown
    string
    -

    $args

    +

    $params

    array
    @@ -425,6 +425,13 @@ display them cleanly

    Classes and interfaces

    +
    +

    DB +

    +

    Extend PHP's PDO class to add some more functionality

    +
    +« More » +

    MM_Controller

    @@ -474,7 +481,7 @@ display them cleanly
    + generated on 2012-04-26T16:50:04-04:00.
    diff --git a/docs/structure.xml b/docs/structure.xml index 5309817..28f47a0 100644 --- a/docs/structure.xml +++ b/docs/structure.xml @@ -5009,7 +5009,7 @@ the last query executed]]> - + Convention-based micro-framework for PHP

    ]]>
    @@ -5019,9 +5019,12 @@ the last query executed]]>
    - + Query/autoload.php + + miniMVC.php + shutdown function @@ -5273,7 +5276,7 @@ display them cleanly]]>
    - + Convention-based micro-framework for PHP

    ]]>
    @@ -5283,389 +5286,536 @@ display them cleanly]]>
    - + + DB + \DB + \Query_Builder + + + + + + + + $instance + + + + + + array + + + + + get_instance + function + + + + + string + + + array + + + \DB + + + + $dbname + + + + + $options + + array + + + + __construct + function + + + + + array + + + + $params + + array + + + + __call + function + + + + + string + + + array + + + mixed + + + + $name + + + + + $params + + + + + + __callStatic + function + + + + + string + + + array + + + + $name + + + + + $args + + array + + + + get_last_error + function + + + + + string + + + + +
    + + + + Convention-based micro-framework for PHP

    ]]>
    + + + + + +
    + __construct function - + - + array - + void - + $members array - + __call function - + - + string - + array - + $name - - $args - - array + + $params + + - + __callStatic function - + - + string - + array - + $name - + $args array - + __toString function - + - + string - + __get function - + - + string - + $name - + __invoke function - + - + miniMVC \miniMVC \ArrayObject - + - - + + - + $instance - + - + \miniMVC - + __construct function - + - - - - __call - function - - - - - string - - + array - + + $members + + array + + + + __call + function + + + + + string + + + array + + + $name - + $args - + __clone function - + - + __invoke function - + - + get_instance function - + - + \miniMVC - + load_class function - + - + string - + string - + void - + $name - + $type - + unload function - + - + string - + $name - + load_config function - + - + string - + $name - + MM_Controller \MM_Controller \miniMVC - + - - + + - + $output - + - + \Output - + $page - + - + \Page - + __construct function - + - + void - + load_model function - + - + string - + array - + void - + $file - + $args - + load_view function - + - + string - + array - + bool - + mixed - + $file - + $data array - + $return - + MM_Model \MM_Model \miniMVC - + - - + + - + __construct function - + - + void - + load_db function - + - + string - + void - + $name @@ -5746,7 +5896,7 @@ display them cleanly]]>
    - + Convention-based micro-framework for PHP

    ]]>
    @@ -6437,7 +6587,7 @@ Used for outputing HTML]]>
    - + Convention-based micro-framework for PHP

    ]]>
    diff --git a/src/index.php b/src/index.php index 7f0700b..daaab4a 100644 --- a/src/index.php +++ b/src/index.php @@ -53,14 +53,11 @@ require(MM_APP_PATH.'config/config.php'); // Require the most important files require(MM_SYS_PATH . "common.php"); +// Catch fatal errors, don't show them +error_reporting((-1) & ~(E_ERROR | E_PARSE)); +register_shutdown_function('shutdown'); + //Set error handlers -// Quercus doesn't define error_get_last... -if(function_exists('error_get_last')) -{ - // Catch fatal errors, don't show them - error_reporting((-1) & ~(E_ERROR | E_PARSE)); - register_shutdown_function('shutdown'); -} set_error_handler('on_error'); set_exception_handler('on_exception'); diff --git a/src/sys/common.php b/src/sys/common.php index 1b50ad2..bb71299 100644 --- a/src/sys/common.php +++ b/src/sys/common.php @@ -414,10 +414,11 @@ function do_include($path) require_once($path); } -// Load Most Common libraries -array_map('do_include', glob(MM_SYS_PATH.'*.php')); - // Load Database classes require_once(MM_SYS_PATH.'Query/autoload.php'); +require_once(MM_SYS_PATH.'miniMVC.php'); + +// Load system libraries +array_map('do_include', glob(MM_SYS_PATH.'*.php')); // End of common.php \ No newline at end of file diff --git a/src/sys/db.php b/src/sys/db.php index e5dcb71..8b0d6e4 100644 --- a/src/sys/db.php +++ b/src/sys/db.php @@ -4,6 +4,7 @@ * * Convention-based micro-framework for PHP * + * @package miniMVC * @author Timothy J. Warren * @copyright Copyright (c) 2011 - 2012 * @link https://github.com/timw4mail/miniMVC @@ -15,19 +16,45 @@ /** * Extend PHP's PDO class to add some more functionality * - * @extends PDO + * @package miniMVC + * @subpackage System */ -class db extends PDO { +class DB extends Query_Builder { - private $statement; + use JSObject; + + /** + * DB connection instances + * + * @var array + */ private static $instance = array(); + /** + * Indexed singleton method + * + * @param string $dbname + * @param array $options + * @return DB + */ public static function &get_instance($dbname="default", array $options=array()) { if ( ! isset(self::$instance[$dbname])) { + // Include the database config file + require_once(MM_APP_PATH.'config/db.php'); + + // Get the correct database in the config file + if( ! is_like_array($db_conf[$dbname])) + { + // Apparently the database doesn't exist + $this->get_last_error(); + trigger_error("Database does not exist", E_USER_ERROR); + die(); + } + //echo 'Creating new instance of db class.'; - self::$instance[$dbname] = self::_get_conf($dbname, $options); + self::$instance[$dbname] = new DB($db_conf[$dbname]); } return self::$instance[$dbname]; @@ -36,96 +63,31 @@ class db extends PDO { // -------------------------------------------------------------------------- /** - * Makes DSN from config file, and creates database object + * Constructor to override PDO constructor - Quercus doesn't seem to override + * the parent constructor unless the arguments match. * - * @param string $dbname - * @param array $options - * @return db object + * @param array $params */ - private static function _get_conf($dbname="default", array $options=array()) + function __construct(array $params=array()) { - // Include the database config file - require(APP_PATH.'config/db.php'); - - // Get the correct database in the config file - if(is_like_array($db_conf[$dbname])) - { - // Array manipulation is too verbose - extract($db_conf[$dbname]); - } - else - { - // Apparently the database doesn't exist - $this->get_last_error(); - trigger_error("Database does not exist", E_USER_ERROR); - die(); - } - - // Sqlite doesn't use dbname param - $dsn = (stripos($type, "sqlite") === FALSE) ? "{$type}:dbname={$db}" : "{$type}:{$db}"; - - // Set hostname if applicable - if(isset($host)) - { - $dsn .= ($host !== "") ? ";host={$host}" : ""; - } + // Let's try connecting now! + parent::__construct($params); - // Set port if applicable - if(isset($port)) - { - $dsn .= ($port !== "") ? ";port={$port}" : ""; - } - - $user = ( ! empty($user)) ? $user : null; - $pass = ( ! empty($pass)) ? $pass : null; - - // Pre-set the error mode - $opts = array( - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - ); - - $options = $opts + $options; - - return new db($dsn, $user, $pass, $options); } // -------------------------------------------------------------------------- /** - * Constructor to override PDO constructor - Quercus doesn't seem to override - * the parent constructor unless the arguments match. + * Override __call in trait to call __call in Query Builder...lol * - * @param string $dsn - * @param string $user - * @param string $pass - * @param array $options + * @param string $name + * @param array $params + * @return mixed */ - function __construct($dsn, $user, $pass, array $options=array()) + public function __call($name, $params=array()) { - // Let's try connecting now! - parent::__construct($dsn, $user, $pass, $options); - + return parent::__call($name, $params); } - - // -------------------------------------------------------------------------- - - /** - * PHP magic method to facilitate dynamic methods - * - * @param string $name - * @param array $args - */ - function __call($name, array $args) - { - if(is_callable($this->$name)) - { - //Add $this to the beginning of the args array - array_unshift($args, $this); - - //Call the dynamic function - return call_user_func_array($this->$name, $args); - } - } // -------------------------------------------------------------------------- @@ -143,101 +105,6 @@ class db extends PDO { } } - // -------------------------------------------------------------------------- - - /** - * Prints out the contents of the object when used as a string - * - * @return string - */ - public function __toString() - { - if(ENVIRONMENT == 'DEVELOPMENT') - { - $args = func_get_args(); - $method = ( ! empty($args)) ? $args[0] : "print_r"; - $data = (isset($args[1])) ? $args[1] : array(); - - if(empty($data)) - { - $data =& $this; - } - - $output = '
    ';
    -			
    -			if($method == "var_dump")
    -			{
    -				ob_start();
    -				var_dump($data);
    -				$output .= ob_get_contents();
    -				ob_end_clean();
    -			}
    -			else if($method == "var_export")
    -			{
    -				ob_start();
    -				var_export($data);
    -				$output .= ob_get_contents();
    -				ob_end_clean();
    -			}	
    -			else
    -			{
    -				$output .= print_r($data, TRUE);
    -			}
    -		
    -			return $output . '
    '; - } - else - { - return ''; - } - } - - // -------------------------------------------------------------------------- - - /** - * Simplifies prepared statements for database queries - * - * @param string $sql - * @param array $data - * @return mixed PDOStatement / FALSE - */ - public function prepare_query($sql, $data) - { - // Prepare the sql - $query = $this->prepare($sql); - - if( ! is_like_array($query)) - { - $this->get_last_error(); - return FALSE; - } - - // Set the statement in the class variable for easy later access - $this->statement =& $query; - - - if( ! is_like_array($data)) - { - trigger_error("Invalid data argument"); - return FALSE; - } - - // Bind the parameters - foreach($data as $k => $value) - { - $res = $query->bindValue($k, $value); - - if( ! $res) - { - trigger_error("Parameter not successfully bound"); - return FALSE; - } - } - - return $query; - - } - // -------------------------------------------------------------------------- /** @@ -265,12 +132,11 @@ class db extends PDO { // Contain the content for buffering ob_start(); - include(APP_PATH.'/errors/error_db.php'); + include(MM_APP_PATH.'/errors/error_db.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; } } - // End of db.php \ No newline at end of file diff --git a/src/sys/miniMVC.php b/src/sys/miniMVC.php index 6cc75de..7421442 100644 --- a/src/sys/miniMVC.php +++ b/src/sys/miniMVC.php @@ -44,17 +44,14 @@ trait JSObject { * PHP magic method to facilitate dynamic methods * * @param string $name - * @param array $args + * @param array $params */ - public function __call($name, array $args) + public function __call($name, $params=array()) { if(is_callable($this->$name)) { - //Add $this object to args - array_push($args, $this); - //Call the dynamic function - return call_user_func_array($this->$name, $args); + return call_user_func_array($this->$name, $params); } } @@ -193,7 +190,7 @@ class miniMVC extends ArrayObject { public function __construct(array $members=array()) { // Allow the class to be used like an array - parent::__construct($members, STD_PROP_LIST | ARRAY_AS_PROPS); + parent::__construct($members); self::$instance =& $this; }