class Crud_AddAction extends CustomBaseAction
{
public function getCredentials()
{
return "{$this->modelName}.edit";
}
public function isSecure()
{
return true;
}
public function executeWrite(AgaviRequestDataHolder $rd)
{
# 1. find out Model we are dealing with, eg. Products/Promotions, in BaseAction
$model = new $this->modelName;
try {
$model->add($parameters['form']);
$this->flash("Added {$this->modelName}!");
$return = 'Success';
} catch(Exception $e) {
$return = 'Error';
$this->flash($e->getMessage());
}
return array($this->modelName,"Add".$return); # eg. Products,AddSuccess
}
}