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


PHP Q::neq方法代碼示例

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


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

示例1: index

 /**
  * トップページ
  *
  * @context integer $package_count パッケージ総數
  * @context $primary_tags primary がセットされているタグリスト(上限付き)
  * @context $recent_releases 最新 OpenpearRelease モデルの配列
  */
 public function index()
 {
     if (Store::has('index/package_count', 3600)) {
         $package_count = Store::get('index/package_count');
     } else {
         $package_count = C(OpenpearPackage)->find_count();
         Store::set('index/package_count', $package_count, 3600);
     }
     if (Store::has('index/primary_tags', 3600)) {
         $primary_tags = Store::get('index/primary_tags');
     } else {
         $primary_tags = OpenpearPackage::getActiveCategories(8);
         Store::set('index/primary_tags', $primary_tags, 3600);
     }
     if (Store::has('index/recent_releases', 3600)) {
         $recent_releases = Store::get('index/recent_releases');
     } else {
         $recent_releases = C(OpenpearPackage)->find_all(new Paginator(5), Q::neq('latest_release_id', null), Q::order('-released_at'));
         Store::set('index/recent_releases', $recent_releases, 3600);
     }
     if (Store::has('index/most_downloaded', 3600)) {
         $most_downloaded = Store::get('index/most_downloaded');
     } else {
         $most_downloaded = C(OpenpearPackage)->find_all(new Paginator(5), Q::order('-download_count'));
         Store::set('index/most_downloaded', $most_downloaded, 3600);
     }
     $this->vars('package_count', $package_count);
     $this->vars('primary_tags', $primary_tags);
     $this->vars('recent_releases', $recent_releases);
     $this->vars('most_downloaded', $most_downloaded);
 }
開發者ID:nequal,項目名稱:Openpear,代碼行數:38,代碼來源:OpenpearNoLogin.php

示例2: after_delete

 public function after_delete()
 {
     $this->_reset_primaries();
     $this->_recount_tags();
     if (C(OpenpearPackageTag)->find_count(Q::neq('package_id', $this->package_id()), Q::eq('tag_id', $this->tag_id())) === 0) {
         $tag = $this->tag();
         $tag->delete();
     }
 }
開發者ID:nequal,項目名稱:Openpear,代碼行數:9,代碼來源:OpenpearPackageTag.php

示例3: validate

 /**
  * 値の妥當性チェックを行う
  */
 public function validate()
 {
     foreach ($this->columns(true) as $name => $column) {
         if (!\ebi\Exceptions::has($name)) {
             $value = $this->{$name}();
             \ebi\Validator::value($name, $value, ['type' => $this->prop_anon($name, 'type'), 'min' => $this->prop_anon($name, 'min'), 'max' => $this->prop_anon($name, 'max'), 'require' => $this->prop_anon($name, 'require')]);
             $unique_together = $this->prop_anon($name, 'unique_together');
             if ($value !== '' && $value !== null && ($this->prop_anon($name, 'unique') === true || !empty($unique_together))) {
                 $uvalue = $value;
                 $q = [\ebi\Q::eq($name, $uvalue)];
                 if (!empty($unique_together)) {
                     foreach (is_array($unique_together) ? $unique_together : [$unique_together] as $c) {
                         $q[] = Q::eq($c, $this->{$c}());
                     }
                 }
                 foreach ($this->primary_columns() as $primary) {
                     if (null !== $this->{$primary->name()}) {
                         $q[] = Q::neq($primary->name(), $this->{$primary->name()});
                     }
                 }
                 if (0 < call_user_func_array([get_class($this), 'find_count'], $q)) {
                     \ebi\Exceptions::add(new \ebi\exception\UniqueException($name . ' unique'), $name);
                 }
             }
             $master = $this->prop_anon($name, 'master');
             if (!empty($master)) {
                 $master = str_replace('.', "\\", $master);
                 if ($master[0] !== '\\') {
                     $master = '\\' . $master;
                 }
                 try {
                     $r = new \ReflectionClass($master);
                 } catch (\ReflectionException $e) {
                     $self = new \ReflectionClass(get_class($this));
                     $r = new \ReflectionClass("\\" . $self->getNamespaceName() . $master);
                 }
                 $mo = $r->newInstanceArgs();
                 $primarys = $mo->primary_columns();
                 if (empty($primarys) || 0 === call_user_func_array([$mo, 'find_count'], [Q::eq(key($primarys), $this->{$name})])) {
                     \ebi\Exceptions::add(new \ebi\exception\NotFoundException($name . ' master not found'), $name);
                 }
             }
             try {
                 if (method_exists($this, '__verify_' . $column->name() . '__') && call_user_func([$this, '__verify_' . $column->name() . '__']) === false) {
                     \ebi\Exceptions::add(new \ebi\exception\VerifyException($column->name() . ' verification failed'), $column->name());
                 }
             } catch (\ebi\Exceptions $e) {
             } catch (\Exception $e) {
                 \ebi\Exceptions::add($e, $column->name());
             }
         }
     }
     \ebi\Exceptions::throw_over();
 }
開發者ID:tokushima,項目名稱:ebi,代碼行數:57,代碼來源:Dao.php

示例4: save_verify

 private final function save_verify()
 {
     foreach ($this->self_columns() as $name => $column) {
         $type = $this->a($name, "type");
         $value = $this->{$name};
         if ($this->a($name, "require") === true && ($value === "" || $value === null)) {
             Exceptions::add(new Exception($name . " required"));
         }
         if ($this->a($name, "unique") === true) {
             $q = array(Q::eq($name, $value));
             foreach ($this->primary_columns() as $column) {
                 if (null !== ($value = $this->{$column->name()}())) {
                     $q[] = Q::neq($column->name(), $this->{$column->name()}());
                 }
             }
             if (0 < call_user_func_array(array(C($this), "find_count"), $q)) {
                 Exceptions::add(new Exception($name . " unique"));
             }
         }
     }
     foreach ($this->self_columns() as $column) {
         if (!$this->{"is" . ucfirst($column->name())}()) {
             Exceptions::add(new Exception("verify fail"));
         }
     }
     $this->__save_verify__();
     Exceptions::validation();
 }
開發者ID:hisaboh,項目名稱:w2t,代碼行數:28,代碼來源:Dao.php

示例5: where_match

 protected function where_match(Q $q, array $self_columns)
 {
     $query = new Q();
     foreach ($q->arArg1() as $cond) {
         if (strpos($cond, "=") !== false) {
             list($column, $value) = explode("=", $cond);
             $not = substr($value, 0, 1) == "!";
             $value = $not ? strlen($value) > 1 ? substr($value, 1) : "" : $value;
             if ($value === "") {
                 $query->add($not ? Q::neq($column, "") : Q::eq($column, ""));
             } else {
                 $query->add($not ? Q::contains($column, $value, $q->param() | Q::NOT) : Q::contains($column, $value, $q->param()));
             }
         } else {
             $columns = array();
             foreach ($self_columns as $column) {
                 $columns[] = $column->name();
             }
             $query->add(Q::contains(implode(",", $columns), explode(" ", $cond), $q->param()));
         }
     }
     return $query;
 }
開發者ID:hisaboh,項目名稱:w2t,代碼行數:23,代碼來源:DbController.php


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