/** * Exports the object as an array. * * You can specify the key type of the array by passing one of the class * type constants. * * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * Defaults to BasePeer::TYPE_PHPNAME. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * * @return array an associative array containing the field names (as keys) and field values */ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['helpHourSignin'][$this->getPrimaryKey()])) { return '*RECURSION*'; } $alreadyDumpedObjects['helpHourSignin'][$this->getPrimaryKey()] = true; $keys = helpHourSigninPeer::getFieldNames($keyType); $result = array($keys[0] => $this->getId(), $keys[1] => $this->getHelphourId(), $keys[2] => $this->getCreatedAt(), $keys[3] => $this->getUpdatedAt()); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->ahelpHour) { $result['helpHour'] = $this->ahelpHour->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } return $result; }
helpHourQuery::create()->findPk($id)->delete(); render_json("Success"); }); $app->post('/submit', function () use($app) { if (!require_authenticated()) { return; } $data = json_decode($app->request->getBody()); $who = get_loggedin_info(); $data->UserId = $who['user']['Id']; $obj = new helpHour(); $obj->fromJSON(json_encode($data)); $obj->setStartTime(convert_timezone($obj->getStartTime())); $obj->setEndTime(convert_timezone($obj->getEndTime())); $obj->save(); render_json($obj->toArray()); }); $app->get('/signin/:id', function ($id) use($app) { $helphour = helpHourQuery::create()->findPk($id); if (!require_authenticated(false, $helphour->getUser()->getNetid())) { return; } if (signin_helphour($helphour)) { render_json("Signed in correctly."); } else { render_json("Already signed in or other error."); } }); }); $app->get('/whoami', function () use($app) { $who = get_loggedin_info();