当前位置: 首页>>代码示例>>PHP>>正文


PHP Kwf_Model_Select::expr方法代码示例

本文整理汇总了PHP中Kwf_Model_Select::expr方法的典型用法代码示例。如果您正苦于以下问题:PHP Kwf_Model_Select::expr方法的具体用法?PHP Kwf_Model_Select::expr怎么用?PHP Kwf_Model_Select::expr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kwf_Model_Select的用法示例。


在下文中一共展示了Kwf_Model_Select::expr方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testChildCountEager

 public function testChildCountEager()
 {
     $s = new Kwf_Model_Select();
     $s->whereId(1);
     $s->expr('parent_child_count');
     $this->_modelChild->getRow($s)->parent_child_count;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:Test.php

示例2: testWithExpr

 public function testWithExpr()
 {
     $s = new Kwf_Model_Select();
     $s->whereEquals('id', 1);
     $s->expr('foo');
     $row = $this->_modelChild->getRow($s);
     $this->assertEquals($row->foo, 777);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:8,代码来源:Test.php

示例3: testParentExpression

 public function testParentExpression()
 {
     $s = new Kwf_Model_Select();
     $s->whereEquals('id', 2);
     $s->expr('parent_bar');
     $row = $this->_model->getRow($s);
     $this->assertEquals(5, $row->parent_bar);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:8,代码来源:Test.php

示例4: testChildCountExpression

 public function testChildCountExpression()
 {
     $s = new Kwf_Model_Select();
     $s->expr('child_count');
     $s->whereId(1);
     $row = $this->_modelFoo->getRow($s);
     $this->assertEquals(2, $row->child_count);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:8,代码来源:Test.php

示例5: testSiblingEager

 public function testSiblingEager()
 {
     $s = new Kwf_Model_Select();
     $s->whereId(1);
     $s->expr('sibling_value');
     $row = $this->_modelChild->getRow($s);
     $this->assertEquals(105, $row->sibling_value);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:8,代码来源:Test.php

示例6: testChildSumWithExpressionOrder

 public function testChildSumWithExpressionOrder()
 {
     $select = new Kwf_Model_Select();
     $s = new Kwf_Model_Select();
     $s->order('foo_value_sum', 'DESC');
     $s->expr('foo_value_sum');
     $row = $this->_modelBar->getRow($s);
     $sum = $row->foo_value_sum;
     $this->assertEquals(6, $sum);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:10,代码来源:Test.php

示例7: getFulltextContent

 public function getFulltextContent()
 {
     $ret = array();
     $model = Kwf_Model_Abstract::getInstance('Kwc_Tags_ComponentToTag');
     $select = new Kwf_Model_Select();
     $select->whereEquals('component_id', $this->getData()->dbId);
     $select->expr('tag_name');
     $tags = array();
     foreach ($model->getRows($select) as $tag) {
         $tags[] = $tag->tag_name;
     }
     //TODO: better separator that also understands solr?
     $ret['keywords'] = implode(' ', $tags);
     return $ret;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:15,代码来源:Component.php

示例8: buildSelect

 public function buildSelect(Request $request, array $options = array())
 {
     $select = new \Kwf_Model_Select();
     if ($request->get('limit')) {
         $select->limit($request->get('limit'), $request->get('start'));
     } else {
         $select->limit(25, $request->get('start'));
     }
     $queryValue = trim($request->get('query'));
     if ($queryValue) {
         $queryColumns = null;
         if (isset($options['queryColumns'])) {
             $queryColumns = $options['queryColumns'];
         }
         $exprs = array();
         if (!$queryColumns) {
             throw new \Kwf_Exception("queryColumns are required to be set");
         }
         if (isset($options['querySplit']) && $options['querySplit']) {
             $queryValue = explode(' ', $queryValue);
         } else {
             $queryValue = array($queryValue);
         }
         foreach ($queryValue as $q) {
             $e = array();
             foreach ($queryColumns as $c) {
                 $e[] = new \Kwf_Model_Select_Expr_Like($c, '%' . $q . '%');
             }
             if (count($e) > 1) {
                 $exprs[] = new \Kwf_Model_Select_Expr_Or($e);
             } else {
                 $exprs[] = $e[0];
             }
         }
         if (count($exprs) > 1) {
             $select->where(new \Kwf_Model_Select_Expr_And($exprs));
         } else {
             $select->where($exprs[0]);
         }
     }
     $restColumns = $this->model->getSerializationColumns(array('rest_read', 'rest'));
     $exprColumns = $this->model->getExprColumns();
     foreach (array_intersect(array_keys($restColumns), $exprColumns) as $i) {
         $select->expr($i);
     }
     return $select;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:47,代码来源:Handler.php


注:本文中的Kwf_Model_Select::expr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。