/**
  * Returns a new memberProfileQuery object.
  *
  * @param     string $modelAlias The alias of a model in the query
  * @param   memberProfileQuery|Criteria $criteria Optional Criteria to build the query from
  *
  * @return memberProfileQuery
  */
 public static function create($modelAlias = null, $criteria = null)
 {
     if ($criteria instanceof memberProfileQuery) {
         return $criteria;
     }
     $query = new memberProfileQuery(null, null, $modelAlias);
     if ($criteria instanceof Criteria) {
         $query->mergeWith($criteria);
     }
     return $query;
 }
Ejemplo n.º 2
0
        }
        $profile = get_user_profile($netid);
        // Ensure the user can't be changed
        $user = $profile->getUser();
        $profile->fromJSON($app->request->getBody());
        if ($settingImage) {
            $user->setPicture('api/images/' . $netid . '.png');
            $user->save();
        }
        // Set the user back
        $profile->setUser($user);
        $profile->save();
        render_json($profile->toArray());
    });
    $app->get('/members', function () use($app) {
        $members = memberProfileQuery::create()->joinWith('User')->where('Visible = 1')->find();
        $members = process_member_resultset($members);
        render_json($members);
    });
});
$app->group('/helphours', function () use($app) {
    $app->get('/all', function () use($app) {
        if (!require_admin()) {
            return;
        }
        $helphours = helpHourQuery::create()->joinWith('User')->find();
        render_json($helphours->toArray());
    });
    $app->get('/get/:userid', function ($userid) use($app) {
        if ($app->request->params('unapproved')) {
            $helphours = helpHourQuery::create()->where('helpHour.UserId = ?', $userid)->find();
Ejemplo n.º 3
0
 /**
  * Removes this object from datastore and sets delete attribute.
  *
  * @param PropelPDO $con
  * @return void
  * @throws PropelException
  * @throws Exception
  * @see        BaseObject::setDeleted()
  * @see        BaseObject::isDeleted()
  */
 public function delete(PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(memberProfilePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $deleteQuery = memberProfileQuery::create()->filterByPrimaryKey($this->getPrimaryKey());
         $ret = $this->preDelete($con);
         if ($ret) {
             $deleteQuery->delete($con);
             $this->postDelete($con);
             $con->commit();
             $this->setDeleted(true);
         } else {
             $con->commit();
         }
     } catch (Exception $e) {
         $con->rollBack();
         throw $e;
     }
 }