SimpleAR uses, for now, a Domain
Model to manage objects.
The Model
class is the heart of this approach.
User uses Model
to give information about its table (columns, table name...)
but these are parsed at class loading and then stored in a Table
object.
Here is the process:
Model::wakeup()
class method;$_columns
, $_tableName
,
$_primaryKey
...) or, if not given, tries to guess stuff out of its class name.
If columns are not given, SimpleAR will perform a query to the DB.Table
object with these informations and store it.Table
objects are stored in a Model::$_tables
, a static array that associate
model class name to Table
objects.
Then, every needed information is accessed through the Table
.
Table
object can be accessed with Model::table()
method.
Article::table()->getPrimaryKey();
// ['id']