Correcting and improving doc block for Model::__construct.

This commit is contained in:
Mark Story 2010-01-01 23:58:07 -05:00
parent 41e6fdf346
commit eab706e772

View file

@ -387,9 +387,34 @@ class Model extends Overloadable {
/**
* Constructor. Binds the model's database table to the object.
*
* @param integer $id Set this ID for this model on startup
* If `$id` is an array it can be used to pass several options into the model.
*
* - id - The id to start the model on.
* - table - The table to use for this model.
* - ds - The connection name this model is connected to.
* - name - The name of the model eg. Post.
* - alias - The alias of the model, this is used for registering the instance in the `ClassRegistry`.
* eg. `ParentThread`
*
* ### Overriding Model's __construct method.
*
* When overriding Model::__construct() be careful to include and pass in all 3 of the
* arguments to `parent::__construct($id, $table, $ds);`
*
* ### Dynamically creating models
*
* You can dynamically create model instances using the the $id array syntax.
*
* {{{
* $Post = new Model(array('table' => 'posts', 'name' => 'Post', 'ds' => 'connection2'));
* }}}
*
* Would create a model attached to the posts table on connection2. Dynamic model creation is useful
* when you want a model object that contains no associations or attached behaviors.
*
* @param mixed $id Set this ID for this model on startup, can also be an array of options, see above.
* @param string $table Name of database table to use.
* @param object $ds DataSource connection object.
* @param string $ds DataSource connection name.
*/
function __construct($id = false, $table = null, $ds = null) {
parent::__construct();