/**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->auser) {
         $this->auser->removeAssignedRoleGlobalRelatedByUserId($this);
     }
     if (null !== $this->aassignedBy) {
         $this->aassignedBy->removeAssignedRoleGlobalRelatedByAssignedBy($this);
     }
     if (null !== $this->arole) {
         $this->arole->removeAssignedRoleGlobal($this);
     }
     $this->id = null;
     $this->user_id = null;
     $this->role_id = null;
     $this->assigned_by = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
 /**
  * Filter the query by a related \SpoilerWiki\User object
  *
  * @param \SpoilerWiki\User|ObjectCollection $user The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildAuthTokenQuery The current query, for fluid interface
  */
 public function filterByuser($user, $comparison = null)
 {
     if ($user instanceof \SpoilerWiki\User) {
         return $this->addUsingAlias(AuthTokenTableMap::COL_USER_ID, $user->getId(), $comparison);
     } elseif ($user instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(AuthTokenTableMap::COL_USER_ID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByuser() only accepts arguments of type \\SpoilerWiki\\User or Collection');
     }
 }
Example #3
0
 /**
  * Exclude object from result
  *
  * @param   ChildUser $user Object to remove from the list of results
  *
  * @return $this|ChildUserQuery The current query, for fluid interface
  */
 public function prune($user = null)
 {
     if ($user) {
         $this->addUsingAlias(UserTableMap::COL_ID, $user->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Example #4
0
 /**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->auser) {
         $this->auser->removeAuthToken($this);
     }
     $this->id = null;
     $this->user_id = null;
     $this->token = null;
     $this->created = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->applyDefaultValues();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
Example #5
0
    if ($app->request->isPost()) {
        $userName = $app->request->post('userName');
        $emailAddress = $app->request->post('emailAddress');
        $password = $app->request->post('password');
        $passwordConfirm = $app->request->post('confirm-password');
        //attempt to make user
        $isValid = true;
        if (\SpoilerWiki\User::userNameExists($userName)) {
            $isValid = false;
            $errors['username_exists'] = "An account with this user name already exists";
        }
        if ($password !== $passwordConfirm) {
            $isValid = false;
            $errors['password_mismatch'] = "The passwords don't match";
        }
        if ($emailAddress != "" && \SpoilerWiki\User::emailExists($emailAddress)) {
            $isValid = false;
            $errors['email_exists'] = "An account is already registered with this email address";
        }
        if ($isValid) {
            $newUser = new \SpoilerWiki\User();
            $newUser->setUsername($userName);
            $newUser->setPassword($password);
            $newUser->setEmail($emailAddress);
            $newUser->save();
            $app->redirect('/login?registered=true');
        }
    }
    $app->view()->display('register.twig', array("errors" => $errors));
})->via('POST', 'GET');
$propelApi = new \PropelToSlim\PropelToSlim($app, '../schema.xml');