Quote Originally Posted by kyberfabrikken
If it is in fact a problem, the next step could be to create a concrete descendant per table. Eg. :
PHP Code:
class BaseIndexAction
{
    var 
$table NULL;
    function 
execute(&$context) {
        
$gateway =& TableGateway::getGateway($this->table);
        
$t =& new Template("index.tpl");
        
$t->set("list"$gateway->getList());
        
$context->response->setContent($t->render());
    }
}

(...)

class 
UserIndexAction extends BaseIndexAction
{
    var 
$table "user";

This is basically how rails is constructed.
The biggest problem with this design is that you are forced to create a lot of files that may be really trivial (simply extends a baseclass). In rails it doesn't seem that scary, since actions are grouped together in namespaces (called "controllers" in rails).
Yes, but maybe to make it more flexible you should be able to set the name of the Model class and a parameter you pass it. For example:
PHP Code:
class BaseIndexAction
{
    var 
$table NULL;
    function 
execute(&$context) {
        
$modelclass $this>modelclass;
        
$gateway =& new $modelclass($this->modelarg);
        
$t =& new Template("index.tpl");
        
$t->set("list"$gateway->getList());
        
$context->response->setContent($t->render());
    }
}

(...)

class 
UserIndexAction extends BaseIndexAction
{
    var 
$modelclass 'TableGateway';
    var 
$modelarg 'test';