All pastes #960822 Raw Edit

Untitled

public php v1 · immutable
#960822 ·published 2008-03-28 14:17 UTC
rendered paste body
  	<sandbox>  		  <crud>        	     <routes>        	       <route name=".add" pattern="^/add$" Module="Crud" action="Add" />        	       <route name=".edit" pattern="^/edit/(id:\d+)$" Module="Crud" action="Edit" />        	       <route name=".manage" pattern="^/manage$" Module="Crud" action="Manage" />        	       <route name=".delete" pattern="^/delete/(id:\d+)$" Module="Crud" action="Delete" />        	     </routes>			  		  </crud>  	</sandbox>  	   <route name=".products" pattern="^/products" module="Products">     <routes>       <xi:include xpointer="xpointer(/configurations/sandbox/crud/routes/route)" />	     </routes>   </route>   <route name=".promotions" pattern="^/promotions" module="Promotions">	     <routes>       <xi:include xpointer="xpointer(/configurations/sandbox/crud/routes/route)" />     </routes>   </route>  	class Crud_AddAction extends CustomBaseAction{	public function executeWrite(AgaviRequestDataHolder $rd)	{		# 1. find out Model we are dealing with, eg. Products/Promotions		$model = new Products;		try {			$model->add($parameters['form']);			$this->flash("Added {$model}!");			$return = 'Success';		} catch(Exception $e) {			$return = 'Error';			$this->flash($e->getMessage());		}		return array($model,"Add".$return); # eg. Products,AddSuccess	}}