當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::getId方法代碼示例

本文整理匯總了PHP中models\User::getId方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::getId方法的具體用法?PHP User::getId怎麽用?PHP User::getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models\User的用法示例。


在下文中一共展示了User::getId方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: save

 public function save(User $user)
 {
     $query = "SELECT * FROM users WHERE username = ?";
     $this->db->query($query, [$user->getUsername()]);
     $result = $this->db->row();
     if ($result) {
         echo 'The username already taken!';
         die;
     }
     $query = "\n            INSERT INTO users (username, email, cash, roleId, password)\n            VALUES (?, ?, ?, ?, ?)\n        ";
     $params = [$user->getUsername(), $user->getEmail(), floatval($user->getCash()), $user->getRole(), $user->getPassword()];
     if ($user->getId()) {
         $query = "UPDATE players SET username = ?, password = ? WHERE id = ?";
         $params[] = $user->getId();
     }
     $this->db->query($query, $params);
     return $this->db->rows() > 0;
 }
開發者ID:BarishYumerov,項目名稱:PHP,代碼行數:18,代碼來源:UserRepository.php

示例2: setOwner

 /**
  * Declares an association between this object and a ChildUser object.
  *
  * @param  ChildUser $v
  * @return $this|\Models\Group The current object (for fluent API support)
  * @throws PropelException
  */
 public function setOwner(ChildUser $v = null)
 {
     if ($v === null) {
         $this->setOwnerId(NULL);
     } else {
         $this->setOwnerId($v->getId());
     }
     $this->aOwner = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildUser object, it will not be re-added.
     if ($v !== null) {
         $v->addMyGroup($this);
     }
     return $this;
 }
開發者ID:xfreddiex,項目名稱:code-sharer,代碼行數:22,代碼來源:Group.php

示例3: getId

 public function getId()
 {
     $this->_load();
     return parent::getId();
 }
開發者ID:nicnocquee,項目名稱:PPION-Website,代碼行數:5,代碼來源:modelsUserProxy.php

示例4: getId

 /**
  * {@inheritDoc}
  */
 public function getId()
 {
     if ($this->__isInitialized__ === false) {
         return (int) parent::getId();
     }
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array());
     return parent::getId();
 }
開發者ID:janvaneck,項目名稱:school,代碼行數:11,代碼來源:__CG__modelsUser.php

示例5: prune

 /**
  * 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;
 }
開發者ID:xfreddiex,項目名稱:code-sharer,代碼行數:14,代碼來源:UserQuery.php

示例6: filterByUser

 /**
  * Filter the query by a related \Models\User object
  *
  * @param \Models\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 ChildCategoryQuery The current query, for fluid interface
  */
 public function filterByUser($user, $comparison = null)
 {
     if ($user instanceof \Models\User) {
         return $this->addUsingAlias(CategoryTableMap::COL_USER_ID, $user->getId(), $comparison);
     } elseif ($user instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(CategoryTableMap::COL_USER_ID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByUser() only accepts arguments of type \\Models\\User or Collection');
     }
 }
開發者ID:OneTimeCZ,項目名稱:Tasker,代碼行數:23,代碼來源:CategoryQuery.php

示例7: saveSessionCookieForUser

 /**
  * Salva o cookie de autenticação
  * @param  \Models\User $user Objeto \Models\User do usuário logado
  */
 public static function saveSessionCookieForUser(\Models\User $user)
 {
     $cookieData = ['id' => $user->getId(), 'token' => $user->getToken()];
     // 2592000 = 60 * 60 * 24 * 30, ou seja, 30 dias em segundos
     setcookie(AUTH_USER_COOKIE_NAME, serialize($cookieData), time() + 2592000);
 }
開發者ID:beingsane,項目名稱:UltimatePHPerguntas,代碼行數:10,代碼來源:SessionsController.php

示例8: filterByUser

 /**
  * Filter the query by a related \Models\User object
  *
  * @param \Models\User $user The related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildSharedQuery The current query, for fluid interface
  */
 public function filterByUser($user, $comparison = null)
 {
     if ($user instanceof \Models\User) {
         return $this->addUsingAlias(SharedTableMap::COL_TO_TYPE, 'user', $comparison)->addUsingAlias(SharedTableMap::COL_TO_ID, $user->getId(), $comparison);
     } else {
         throw new PropelException('filterByUser() only accepts arguments of type \\Models\\User');
     }
 }
開發者ID:OneTimeCZ,項目名稱:Tasker,代碼行數:18,代碼來源:SharedQuery.php

示例9: update

 private static function update(User $model)
 {
     $db = Database::getInstance('app');
     $query = "UPDATE users SET username= :username, email= :email, password= :password, role_id= :role_id, f_name= :f_name, l_name= :l_name, gender= :gender, date_of_birth= :date_of_birth, registered_at= :registered_at WHERE id = :id";
     $result = $db->prepare($query);
     $result->execute([':id' => $model->getId(), ':username' => $model->getUsername(), ':email' => $model->getEmail(), ':password' => $model->getPassword(), ':role_id' => $model->getRole_id(), ':f_name' => $model->getF_name(), ':l_name' => $model->getL_name(), ':gender' => $model->getGender(), ':date_of_birth' => $model->getDate_of_birth(), ':registered_at' => $model->getRegistered_at()]);
 }
開發者ID:phkolarov,項目名稱:algaivel,代碼行數:7,代碼來源:UsersRepository.php

示例10: updateUser

 public function updateUser(User $user)
 {
     $result = $this->db->prepare("\n\t\t\tUPDATE user\n\t\t\tSET money = ?,\n\t\t\t\tbanned = ?\n\t\t\tWHERE id = ?\n\t\t");
     $result->execute([$user->getMoney(), $user->getBanned(), $user->getId()]);
 }
開發者ID:pavel-r-rashkov,項目名稱:Web-Development-Project,代碼行數:5,代碼來源:UserRepository.php

示例11: startSession

 /**
  * ### Starts a session for the given user
  *
  * @param \Models\User $user
  */
 private static function startSession($user)
 {
     $_SESSION['logged_in'] = 1;
     $_SESSION['user'] = $user->getId();
 }
開發者ID:JanFoerste,項目名稱:blivy-website,代碼行數:10,代碼來源:Auth.php

示例12: update

 private static function update(User $model)
 {
     $db = Database::getInstance('app');
     $query = "UPDATE user SET username= :username, password= :password, registerDate= :registerDate, emailVerified= :emailVerified, email= :email, createdAt= :createdAt, updatedAt= :updatedAt WHERE id = :id";
     $result = $db->prepare($query);
     $result->execute([':id' => $model->getId(), ':username' => $model->getUsername(), ':password' => $model->getPassword(), ':registerDate' => $model->getRegisterDate(), ':emailVerified' => $model->getEmailVerified(), ':email' => $model->getEmail(), ':createdAt' => $model->getCreatedAt(), ':updatedAt' => $model->getUpdatedAt()]);
 }
開發者ID:zhivkokasabov,項目名稱:algaivel,代碼行數:7,代碼來源:UserRepository.php

示例13: setOriginUser

 /**
  * Declares an association between this object and a ChildUser object.
  *
  * @param  ChildUser $v
  * @return $this|\Models\Notification The current object (for fluent API support)
  * @throws PropelException
  */
 public function setOriginUser(ChildUser $v = null)
 {
     if ($v === null) {
         $this->setOriginType(null);
     } else {
         $this->setOriginType('user');
     }
     if ($v === null) {
         $this->setOriginId(NULL);
     } else {
         $this->setOriginId($v->getId());
     }
     $this->aOriginUser = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildUser object, it will not be re-added.
     if ($v !== null) {
         $v->addNotificationRelatedByOriginTypeOriginId($this);
     }
     return $this;
 }
開發者ID:OneTimeCZ,項目名稱:Tasker,代碼行數:27,代碼來源:Notification.php


注:本文中的models\User::getId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。