Skip to content

Instantly share code, notes, and snippets.

@yjeroen
Created December 30, 2011 10:02
Show Gist options
  • Save yjeroen/1539104 to your computer and use it in GitHub Desktop.
Save yjeroen/1539104 to your computer and use it in GitHub Desktop.
## tr() is a custom trace function that does Yii::trace(CVarDumper::dumpAsString($user),'jlog');
CONTROLLER:
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model=new Ticket;
$model->incident_id = $this->_incident->id;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Ticket']))
{
$model->attributes=$_POST['Ticket'];
// if($model->save())
// $this->redirect(array('view','id'=>$model->id));
tr($_POST['Ticket']);
tr($model);
tr($model->id);
if($model->save())
tr('save succes');
else
tr('save not succesvol');
tr($model->id);
tr($model->primaryKey);
tr($model);
tr('END',1);
}
$this->render('create',array(
'model'=>$model,
));
}
phpMyAdmin STRUCTURE DUMP:
CREATE TABLE IF NOT EXISTS `ics_ticket` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`incident_id` smallint(5) unsigned NOT NULL,
`ticket_nr` smallint(5) unsigned NOT NULL,
`ticket_type` tinyint(3) unsigned NOT NULL,
`status` tinyint(3) unsigned NOT NULL,
`oplosgroep` tinyint(3) unsigned default NULL,
`start_tijd` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`eind_tijd` timestamp NULL default NULL,
`prio` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_ticket_incident` (`incident_id`),
KEY `FK_tickettype_names` (`ticket_type`),
KEY `FK_ticket_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=55 ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment