Пример #1
0
 /**
  * Filter password
  *
  * @param string $value
  */
 public function validateLogin($value)
 {
     $user = User::finder()->filter(['LOGIN' => $value])->limit(1)->get();
     if ($user === false) {
         return $this->trans('user.form.access_form.login_not_found');
     } else {
         $this->user = $user;
     }
 }
Пример #2
0
 /**
  * Return SQL Builder
  *
  * @param array $sort
  * @param array $filter
  * @param type $offset
  * @param type $limit
  * @return \BX\DB\Filter\SqlBuilder
  */
 protected function getList(array $sort, array $filter, $offset = null, $limit = null)
 {
     $return = User::finder()->sort($sort)->filter($filter);
     if ($offset !== null) {
         $return->offset($offset);
     }
     if ($limit !== null) {
         $return->limit($limit);
     }
     return $return;
 }
Пример #3
0
 /**
  * Update news category
  *
  * @param integer $id
  * @param array $category
  * @return integer
  */
 public function update($id, $category)
 {
     $repo = $this->store()->getRepository('news_category');
     $repo->appendLockTables(['tbl_news']);
     if (isset($category['USER_ID'])) {
         $user_id = intval($category['USER_ID']);
         $user = User::finder()->filter(['ID' => $user_id])->count();
         if ($user == 0) {
             throw new \RuntimeException('User is not found');
         }
     }
     $entity = $this->finder()->filter(['ID' => $id])->get();
     if ($entity === false) {
         $repo->rollback();
         throw new \RuntimeException("Error news category is not found.");
     }
     $entity->setData($category);
     return $this->store()->update($repo, $entity);
 }