[Solar-talk] Changes afoot: a new Model class
Paul M Jones
pmjones at ciaweb.net
Thu Feb 8 11:54:13 PST 2007
Hi Jeff,
> Can someone give me a few lines on the use of the new Model class,
> how would I
> go about using it with a existing data model,
Well, it's not fully useful yet ... but so you can get an idea of
what I expect will be the normal use:
> is the following sort of right?
>
> class Bulldog_Model_Nodes extends Solar_Sql_Model {
> ....same as other data models
> }
>
> 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
> $this->node = $this->nodes->fetchOne();
> }
> }
Yes, that looks exactly like the normal usage I expect. Nicely done
sir. :-)
--
Paul M. Jones <http://paul-m-jones.com>
Solar: Simple Object Library and Application Repository
for PHP5. <http://solarphp.com>
Join the Solar community wiki! <http://solarphp.org>
Savant: The simple, elegant, and powerful solution for
templates in PHP. <http://phpsavant.com>
More information about the solar-talk
mailing list