[Solar-talk] Solar Content & Model brainstorm
Rodrigo Moraes
rodrigo.moraes at gmail.com
Sun Aug 6 07:38:36 PDT 2006
Hi all.
I've been playing with the whole idea of Solar_Content & Model
classes, and thinking about how Solar could provide a general use for
them. Solar Content classes are more a very well thought and tied demo
than something you can pick and use, imho, but this could be
different.
Models requirements differs (see the "Solar Model performance"
thread), but Solar could still provide a content class to tie them. A
small change I've made to use the areas, nodes and tags concepts was
to create my own Content class and then define which models are used:
protected $_Tipos_Content = array(
'sql' => 'sql',
'areas' => 'Tipos_Model_Areas',
'nodes' => 'Tipos_Model_Nodes',
'tags' => 'Tipos_Model_Tags',
);
...and then in __construct():
...
$this->areas = Solar::factory($this->_config['areas'], $this->_config);
$this->nodes = Solar::factory($this->_config['nodes'], $this->_config);
$this->tags = Solar::factory($this->_config['tags'], $this->_config);
...
This way, you can still use the areas and tags models, but change the
node model to use your own, for example. Being a bit more radical ;-),
the models could be defined in an array and then set in a foreach().
Then who would need to create a new Content wrapper class? :-)
Another way to add some flexibility is to add a propertie to Solar_App:
/**
*
* Content management class name.
*
* @var string
*
*/
protected $_content_class = 'Solar_Content';
and then in _setup():
...
// register a Solar_Content object if not already.
if (! Solar::isRegistered('content')) {
Solar::register('content', Solar::factory($this->_content_class));
}
...
Solar would then deal out-of-the-box with different content & model
approaches. Perhaps you have other ideas? Or see a big no-no in my
proposal?
I've also been thinking about the nodes table, and how to use
different table names and models (with some required columns) to have
"specialized" nodes tables instead of just one. This is just an idea;
I would love to hear proposals to add some more flexibility to Solar
Content & Model classes.
regards,
rodrigo moraes / brazil
More information about the solar-talk
mailing list