예제 #1
0
 public function delete($userId = null, $providerId = null, $providerUserId = null)
 {
     MDataType::mustBeNullableInt($userId);
     MDataType::mustBeNullableInt($providerId);
     MDataType::mustBeNullableString($providerUserId);
     $sql = "CALL mt_provider_user_delete(?,?, ?);";
     $query = new MPDOQuery($sql, $this->connection);
     $query->bindValue($userId);
     $query->bindValue($providerId);
     $query->bindValue($providerUserId);
     $queryResult = $query->exec();
     if ($queryResult == false) {
         throw new DeleteProviderException($query->getLastError());
     }
 }
예제 #2
0
파일: MMap.php 프로젝트: mpstyle/mtoolkit
 /**
  * Returns the value associated with the key <i>$key</i>.
  * 
  * @param mixed $value
  * @param string $defaultKey
  * @return string
  * @throws MWrongTypeException
  */
 public function getKey($value, $defaultKey = null)
 {
     if ($this->isValidType($value) === false) {
         throw new MWrongTypeException("\$value", $this->getType(), $value);
     }
     MDataType::mustBeNullableString($defaultKey);
     $key = array_search($value, $this->map);
     if ($key === false && is_null($defaultKey) === false) {
         $key = $defaultKey;
     }
     return $key;
 }
예제 #3
0
 /**
  * @param string $output
  * @return \MToolkit\Controller\MAbstractHttpHandler
  */
 public function setOutput($output)
 {
     MDataType::mustBeNullableString($output);
     $this->output = $output;
     return $this;
 }
예제 #4
0
 /**
  * @param string $className
  * @return MPDOResult
  */
 public function setClassName($className)
 {
     MDataType::mustBeNullableString($className);
     $this->className = $className;
     return $this;
 }
예제 #5
0
 /**
  * @param int|null $userId
  * @param string|null $username
  * @param string|null $email
  * @return User[]
  * @throws \Exception
  */
 public function get($userId = null, $username = null, $email = null)
 {
     MDataType::mustBeNullableInt($userId);
     MDataType::mustBeNullableString($username);
     MDataType::mustBeNullableString($email);
     $userList = array();
     $sql = "CALL mt_user_get(?, ?, ?);";
     $query = new MPDOQuery($sql, $this->connection);
     $query->bindValue($userId);
     $query->bindValue($username);
     $query->bindValue($email);
     $queryResult = $query->exec();
     if ($queryResult == false || $query->getResult()->rowCount() <= 0) {
         return $userList;
     }
     foreach ($query->getResult() as $row) {
         $user = new User();
         $enabledDate = \DateTime::createFromFormat('Y-m-d H:i:s', $row['enabled_date']);
         $user->setId((int) $row['id'])->setEmail($row['email'])->setPassword($row['password'])->setPhoneNumber($row['phone_number'])->setTwoFactorEnabled($row['two_factor_enabled'] == 1 ? true : false)->setEnabledDate($enabledDate)->setEnabled($row['enabled'] == 1 ? true : false)->setAccessFailedCount((int) $row['access_failed_count'])->setUserName($row['username'])->setRoleList($this->roleBook->get((int) $row['id']))->setProviderUserList($this->providerUserBook->get((int) $row['id']));
         $userList[] = $user;
     }
     return $userList;
 }
예제 #6
0
 /**
  * Returns true if the file called <i>$name</i> exists; otherwise returns false.<br />
  * If <i>$name</i> is null the <i>$path</i> passed to the construct will be used.
  * 
  * @param string|null $name
  * @return boolean
  */
 public function exists($name = null)
 {
     MDataType::mustBeNullableString($name);
     if ($name != null) {
         $fileInfo = new MFileInfo($name);
         return $fileInfo->exists();
     }
     return $this->fileInfo->exists();
 }