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


PHP Kwf_Model_Select::ignoreDeleted方法代码示例

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


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

示例1: testIgnoreDeleted

 public function testIgnoreDeleted()
 {
     $model = Kwf_Model_Abstract::getInstance('Kwf_Model_Union_DeletedFlag_TestModel');
     $s = new Kwf_Model_Select();
     $s->ignoreDeleted();
     $this->assertEquals($model->countRows($s), 3);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:Test.php

示例2: onRowEvent

 public function onRowEvent(Kwf_Events_Event_Row_Abstract $ev)
 {
     $eventCls = get_class($ev);
     $unionModel = $this->_getModel();
     $sourceRow = $ev->row;
     $sourceModel = $sourceRow->getModel();
     foreach ($unionModel->getUnionModels() as $modelKey => $m) {
         if ($m === $sourceModel) {
             $s = new Kwf_Model_Select();
             $s->whereId($modelKey . $sourceRow->{$sourceModel->getPrimaryKey()});
             $s->ignoreDeleted();
             $unionRow = $unionModel->getRow($s);
             if (!$unionRow) {
                 $unionRow = $unionModel->_getRowById($modelKey . $sourceRow->{$sourceModel->getPrimaryKey()});
                 $this->fireEvent(new Kwf_Events_Event_Row_Deleted($unionRow));
             } else {
                 $this->fireEvent(new $eventCls($unionRow));
             }
             return;
         }
     }
     throw new Kwf_Exception("Didn't find sourceModel as unionModel");
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:23,代码来源:Events.php

示例3: _convertSelect

 private function _convertSelect($select, $modelKey, $m)
 {
     $s = new Kwf_Model_Select();
     if ($p = $select->getPart(Kwf_Model_Select::WHERE_ID)) {
         if (substr($p, 0, strlen($modelKey)) == $modelKey) {
             $s->whereId(substr($p, strlen($modelKey)));
         } else {
             return null;
         }
     }
     if ($p = $select->getPart(Kwf_Model_Select::WHERE_EQUALS)) {
         foreach ($p as $f => $v) {
             if ($f == 'id') {
                 if (is_array($v)) {
                     $filterV = array();
                     foreach ($v as $i) {
                         if (substr($i, 0, strlen($modelKey)) == $modelKey) {
                             $filterV[] = substr($i, strlen($modelKey));
                         }
                     }
                     if (!$filterV) {
                         return null;
                     }
                     $v = $filterV;
                 } else {
                     if (substr($v, 0, strlen($modelKey)) == $modelKey) {
                         $v = substr($v, strlen($modelKey));
                     } else {
                         return null;
                     }
                 }
             }
             if (in_array($f, $this->_getOwnColumns())) {
                 $f = $this->_mapColumn($m, $f);
                 $s->whereEquals($f, $v);
             }
         }
     }
     if ($p = $select->getPart(Kwf_Model_Select::WHERE_NOT_EQUALS)) {
         foreach ($p as $f => $v) {
             if ($f == 'id') {
                 if (substr($v, 0, strlen($modelKey)) != $modelKey) {
                     continue;
                 } else {
                     $v = substr($v, strlen($modelKey));
                 }
             }
             if (in_array($f, $this->_getOwnColumns())) {
                 $f = $this->_mapColumn($m, $f);
                 $s->whereNotEquals($f, $v);
             }
         }
     }
     if ($p = $select->getPart(Kwf_Model_Select::WHERE_NULL)) {
         foreach ($p as $f) {
             if (in_array($f, $this->_getOwnColumns())) {
                 $f = $this->_mapColumn($m, $f);
                 $s->whereNull($f);
             }
         }
     }
     if ($p = $select->getPart(Kwf_Model_Select::WHERE_EXPRESSION)) {
         foreach ($p as $expr) {
             $e = $this->_convertExpr($expr, $modelKey, $m);
             if ($e) {
                 $s->where($e);
             }
         }
     }
     if ($p = $select->getPart(Kwf_Model_Select::IGNORE_DELETED)) {
         $s->ignoreDeleted($p);
     }
     if (isset($this->_mergeSelects[$modelKey])) {
         $s->merge($this->_mergeSelects[$modelKey]);
     }
     return $s;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:77,代码来源:Union.php

示例4: getExprValue

 public function getExprValue($row, $name)
 {
     if ($name instanceof Kwf_Model_Select_Expr_Interface) {
         $expr = $name;
     } else {
         $expr = $this->_exprs[$name];
     }
     if ($expr instanceof Kwf_Model_Select_Expr_Child_Contains) {
         if (!$row instanceof Kwf_Model_Row_Interface) {
             $row = $this->getRow($row[$this->getPrimaryKey()]);
         }
         $ret = (bool) $row->countChildRows($expr->getChild(), $expr->getSelect());
         return $ret;
     } else {
         if ($expr instanceof Kwf_Model_Select_Expr_Child_First) {
             if (!$row instanceof Kwf_Model_Row_Interface) {
                 $row = $this->getRow($row[$this->getPrimaryKey()]);
             }
             $s = clone $expr->getSelect();
             $s->limit(1);
             $childRows = $row->getChildRows($expr->getChild(), $s);
             if (count($childRows)) {
                 return $childRows[0]->{$expr->getField()};
             } else {
                 return null;
             }
         } else {
             if ($expr instanceof Kwf_Model_Select_Expr_Child) {
                 if (!$row instanceof Kwf_Model_Row_Interface) {
                     $row = $this->getRow($row[$this->getPrimaryKey()]);
                 }
                 $childs = $row->getChildRows($expr->getChild(), $expr->getSelect());
                 return self::_evaluateExprForRowset($childs, $expr->getExpr());
             } else {
                 if ($expr instanceof Kwf_Model_Select_Expr_Parent) {
                     if (!$row instanceof Kwf_Model_Row_Interface) {
                         $row = $this->getRow($row[$this->getPrimaryKey()]);
                     }
                     $reference = $row->getModel()->getReference($expr->getParent());
                     $parentModel = $row->getModel()->getReferencedModel($expr->getParent());
                     $select = new Kwf_Model_Select();
                     $select->whereId($row->{$reference['column']});
                     $select->ignoreDeleted(true);
                     $parent = $parentModel->getRow($select);
                     if (!$parent) {
                         return null;
                     }
                     $field = $expr->getField();
                     if (is_string($field)) {
                         return $parent->{$field};
                     } else {
                         return $this->getExprValue($parent, $field);
                     }
                 } else {
                     if ($expr instanceof Kwf_Model_Select_Expr_Concat) {
                         $ret = '';
                         foreach ($expr->getExpressions() as $e) {
                             if ($e instanceof Kwf_Model_Select_Expr_Interface) {
                                 $ret .= $this->getExprValue($row, $e);
                             } else {
                                 if (is_array($row)) {
                                     $ret .= $row[$e];
                                 } else {
                                     $ret .= $row->{$e};
                                 }
                             }
                         }
                         return $ret;
                     } else {
                         if ($expr instanceof Kwf_Model_Select_Expr_String) {
                             return $expr->getString();
                         } else {
                             if ($expr instanceof Kwf_Model_Select_Expr_Boolean) {
                                 return $expr->getValue();
                             } else {
                                 if ($expr instanceof Kwf_Model_Select_Expr_Integer) {
                                     return $expr->getValue();
                                 } else {
                                     if ($expr instanceof Kwf_Model_Select_Expr_StrPad) {
                                         $f = $expr->getField();
                                         if (is_array($row)) {
                                             $v = $row[$f];
                                         } else {
                                             $v = $row->{$f};
                                         }
                                         // faking mysql's implementation of LPAD / RPAD
                                         // mysql cuts always right when the string is too long, it does not
                                         // depend on the pad-type
                                         if ($expr->getPadLength() < mb_strlen($v)) {
                                             return substr($v, 0, $expr->getPadLength());
                                         }
                                         $padType = STR_PAD_RIGHT;
                                         if ($expr->getPadType() == Kwf_Model_Select_Expr_StrPad::LEFT) {
                                             $padType = STR_PAD_LEFT;
                                         } else {
                                             if ($expr->getPadType() == Kwf_Model_Select_Expr_StrPad::RIGHT) {
                                                 $padType = STR_PAD_RIGHT;
                                             }
                                         }
                                         return str_pad($v, $expr->getPadLength(), $expr->getPadStr(), $padType);
//.........这里部分代码省略.........
开发者ID:koala-framework,项目名称:koala-framework,代码行数:101,代码来源:Abstract.php


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