id = $notice->id; # very essential $photo->title = $action->trimmed('photo-title'); $att = $notice->attachments(); if(empty($att)) { # no attachment uploaded? $action->clientError(_('No photo was uploaded')); $photo->delete(); } $att = $att[0]; # just use the 1st one :P $photo->url = $att->url; # TODO: Size the photo up/down and # save copies of different sizes $photo->insert(); } static function schemaDef() { return array(new ColumnDef('id', 'int', /*size*/null, /*nullable*/false, /*key*/'PRI'), new ColumnDef('title', 'varchar', /*size*/255, /*nullable*/false), new ColumnDef('url', 'varchar', 255, false), new ColumnDef('description', 'text', null, true)); } }