[Solar-talk] Changes afoot: a new Model class
Rodrigo Moraes
rodrigo.moraes at gmail.com
Thu Feb 8 11:58:13 PST 2007
On 2/8/07, Jeff Surgeson wrote:
> Cant seem to work out how this should be done, any help would be appreciated!
Ok, here's something to start. You'll need a table 'nodes' (the table
name follows the model name) and this should work (I haven't
discovered how to config the stack to find the vendor, so there's a
stack hack in _setup()):
Btw, I don't know what you mean by "same as other data models". What's
inside Bulldog_Model_Nodes?
------------------------------------------------
class Bulldog_Model_Nodes extends Solar_Sql_Model {
protected function _setup()
{
$this->_stack->add('Bulldog_Model_');
}
... more model code...
}
class Bulldog_App_Main extends Bulldog_App {
public $nodes;
public $node;
protected function _setup()
{
parent::_setup();
$this->nodes = Solar::factory('Bulldog_Model_Nodes');
}
public function actionHome()
{
// get a single record from the model
$id = 1;
$this->node = $this->nodes->fetch($id);
}
}
-------------------------------
http://tipos.com.br
More information about the solar-talk
mailing list