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


PHP Kwf_Model_Select::whereNotEquals方法代码示例

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


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

示例1: _getSelect

 protected function _getSelect($row)
 {
     $ret = new Kwf_Model_Select();
     foreach ($this->_groupBy as $k => $field) {
         if (is_array($field)) {
             $values = $field;
             $field = $k;
             $valueFound = false;
             foreach ($values as $value) {
                 if ($row->{$field} == $value) {
                     $valueFound = true;
                     $ret->whereEquals($field, $value);
                     break;
                 }
             }
             if (!$valueFound) {
                 $ret->whereNotEquals($field, $values);
             }
         } else {
             if (is_null($row->{$field})) {
                 $ret->whereNull($field);
             } else {
                 $ret->whereEquals($field, $row->{$field});
             }
         }
     }
     return $ret;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:28,代码来源:AutoIncrement.php

示例2: testProcessInputFileUploadedNothingExisting

 public function testProcessInputFileUploadedNothingExisting()
 {
     $file = tempnam('/tmp', 'uploadtest');
     file_put_contents($file, 'foo');
     $input = array('File' => array('error' => 0, 'tmp_name' => $file, 'type' => 'plain/text', 'name' => 'test.txt'));
     $data = $this->_field->processInput($this->_row, $input);
     $s = new Kwf_Model_Select();
     $s->whereNotEquals('id', array($this->_uploadId1, $this->_uploadId2));
     $r = $this->_uploadsModel->getRow($s);
     $this->assertEquals($data, array('File' => $r->id));
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:11,代码来源:FileTest.php

示例3: filter

 public function filter($row)
 {
     if (is_null($this->_sourceField)) {
         $value = $row->__toString();
     } else {
         $f = $this->_sourceField;
         $value = $row->{$f};
     }
     $value = Kwf_Filter::filterStatic($value, 'Ascii');
     if ($row instanceof Kwf_Model_Row_Interface) {
         $select = new Kwf_Model_Select();
         foreach ($this->_groupBy as $f) {
             $select->whereEquals($f, $row->{$f});
         }
         $pk = $row->getModel()->getPrimaryKey();
         if ($row->{$pk}) {
             $select->whereNotEquals($pk, $row->{$pk});
         }
         $x = 0;
         $unique = $value;
         while (!$this->_isUnique($unique, $select, $row->getModel())) {
             $unique = $value . '_' . ++$x;
         }
     } else {
         $where = array();
         foreach ($this->_groupBy as $f) {
             if (is_null($row->{$f})) {
                 $where["ISNULL({$f})"] = '';
             } else {
                 $where["{$f} = ?"] = $row->{$f};
             }
         }
         foreach ($row->getPrimaryKey() as $k => $i) {
             if (!is_null($i)) {
                 $where["{$k} != ?"] = $i;
             }
         }
         $x = 0;
         $unique = $value;
         $where["{$this->_field} = ?"] = $unique;
         while ($row->getTable()->fetchAll($where)->count() > 0) {
             $unique = $value . '_' . ++$x;
             $where["{$this->_field} = ?"] = $unique;
         }
     }
     return $unique;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:47,代码来源:UniqueAscii.php

示例4: filter

 public function filter($row)
 {
     if (is_null($this->_sourceField)) {
         $value = $row->__toString();
     } else {
         $f = $this->_sourceField;
         $value = $row->{$f};
     }
     $value = Kwf_Filter::filterStatic($value, 'Ascii');
     $select = new Kwf_Model_Select();
     foreach ($this->_groupBy as $f) {
         $select->whereEquals($f, $row->{$f});
     }
     $pk = $row->getModel()->getPrimaryKey();
     if ($row->{$pk}) {
         $select->whereNotEquals($pk, $row->{$pk});
     }
     $x = 0;
     $unique = $value;
     while (!$this->_isUnique($unique, $select, $row->getModel())) {
         $unique = $value . '_' . ++$x;
     }
     return $unique;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:24,代码来源:UniqueAscii.php

示例5: _convertSelectForSibling

 private function _convertSelectForSibling($select, $m)
 {
     $s = new Kwf_Model_Select();
     if ($p = $select->getPart(Kwf_Model_Select::WHERE_EQUALS)) {
         foreach ($p as $f => $v) {
             if (!in_array($f, $this->_getOwnColumns()) && $m->hasColumn($f)) {
                 $s->whereEquals($f, $v);
             }
         }
     }
     if ($p = $select->getPart(Kwf_Model_Select::WHERE_NOT_EQUALS)) {
         foreach ($p as $f => $v) {
             if (!in_array($f, $this->_getOwnColumns()) && $m->hasColumn($f)) {
                 $s->whereNotEquals($f, $v);
             }
         }
     }
     if ($p = $select->getPart(Kwf_Model_Select::WHERE_NULL)) {
         foreach ($p as $f) {
             if (!in_array($f, $this->_getOwnColumns()) && $m->hasColumn($f)) {
                 $s->whereNull($f);
             }
         }
     }
     if ($p = $select->getPart(Kwf_Model_Select::WHERE_EXPRESSION)) {
         foreach ($p as $expr) {
             $e = $this->_convertExprForSibling($expr, $m);
             if ($e) {
                 $s->where($e);
             }
         }
     }
     return $s;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:34,代码来源:Union.php

示例6: jsonMakeHomeAction

 public function jsonMakeHomeAction()
 {
     $id = $this->_getParam('id');
     $row = Kwf_Model_Abstract::getInstance('Kwc_Root_Category_GeneratorModel')->getRow($id);
     if (!$row) {
         throw new Kwf_Exception("didn't find row to set home");
     }
     if (!$this->_hasPermissions($row, 'makeHome')) {
         throw new Kwf_Exception("Making home this row is not allowed.");
     }
     $root = Kwf_Component_Data_Root::getInstance();
     $component = $root->getComponentById($id, array('ignoreVisible' => true));
     if (!$component->generator->getGeneratorFlag('hasHome')) {
         throw new Kwf_Exception("Generator doesn't have hasHome flag set");
     }
     if (get_class($component) != 'Kwf_Component_Data') {
         //da die data klasse auf Kwf_Component_Data_Home angepasst geändert muss kann das nicht
         //gleichzeitig FirstChildPage oder LinkIntern sein. Daher verbieten.
         $name = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($component->componentClass, 'componentName'));
         throw new Kwf_Exception_Client(trlKwf("You can't set {0} as Home", $name));
     }
     while ($component) {
         if (Kwc_Abstract::getFlag($component->componentClass, 'hasHome')) {
             $homeComponent = $component;
             $component = null;
         } else {
             $component = $component->parent;
         }
     }
     if ($row) {
         $s = new Kwf_Model_Select();
         $s->whereEquals('is_home', true);
         $s->whereNotEquals('id', $id);
         $oldRows = Kwf_Model_Abstract::getInstance('Kwc_Root_Category_GeneratorModel')->getRows($s);
         $oldId = $id;
         $oldVisible = false;
         foreach ($oldRows as $oldRow) {
             $component = $root->getComponentById($oldRow->id, array('ignoreVisible' => true));
             while ($component) {
                 if (Kwc_Abstract::getFlag($component->componentClass, 'hasHome')) {
                     if ($component === $homeComponent) {
                         $oldId = $oldRow->id;
                         $oldVisible = $oldRow->visible;
                         if (!$this->_hasPermissions($oldRow, 'makeHome')) {
                             throw new Kwf_Exception("Making home this row is not allowed.");
                         }
                         $oldRow->is_home = 0;
                         $oldRow->save();
                     }
                     $component = null;
                 } else {
                     $component = $component->parent;
                 }
             }
         }
         $row->is_home = 1;
         $row->save();
         $this->view->home = $id;
         $this->view->oldhome = $oldId;
         $this->view->oldhomeVisible = $oldVisible;
     } else {
         $this->view->error = 'Page not found';
     }
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:64,代码来源:PagesController.php

示例7: testCreatesImageComponentx

 public function testCreatesImageComponentx()
 {
     $uploadsModel = Kwf_Model_Abstract::getInstance('Kwc_Basic_Text_Image_UploadsModel');
     $upload1 = $uploadsModel->getRows()->current();
     $c = $this->_root->getComponentById(1008)->getComponent();
     $row = $c->getRow();
     $html = '<p><img src="http://www.vivid-planet.com/assets/web/images/structure/logo.png" /></p>';
     $html = $row->tidy($html);
     $this->assertRegExp("#^<p>\n  <img src=\"/kwf/kwctest/Kwc_Basic_Text_Root/media/Kwc_Basic_Text_Image_TestComponent/1008-i1/dh-100-[0-9a-z]+/[0-9a-z]+/[0-9]+/logo.png\" width=\"100\" height=\"100\" />\n</p>\$#ms", $html);
     $cc = array_values($c->getData()->getChildComponents());
     $this->assertEquals(1, count($cc));
     $this->assertEquals('1008-i1', current($cc)->componentId);
     $m = Kwc_Basic_Text_Component::createChildModel($c->getData()->componentClass);
     $rows = $m->getRows($m->select()->whereEquals('component_id', '1008'));
     $this->assertEquals(1, count($rows));
     $row = $rows->current();
     $this->assertEquals('image', $row->component);
     $this->assertEquals('1', $row->nr);
     $s = new Kwf_Model_Select();
     $s->whereNotEquals('id', $upload1->id);
     $upload2 = $uploadsModel->getRows($s)->current();
     $this->assertEquals('image/png', $upload2->mime_type);
     $this->assertEquals('png', $upload2->extension);
     $this->assertEquals('logo', $upload2->filename);
     $this->assertEquals(file_get_contents($upload2->getFileSource()), file_get_contents('http://www.vivid-planet.com/assets/web/images/structure/logo.png'));
     $m = Kwf_Model_Abstract::getInstance('Kwc_Basic_Text_Image_TestModel');
     $rows = $m->getRows($m->select()->whereEquals('component_id', '1008-i1'));
     $this->assertEquals(1, count($rows));
     $row = $rows->current();
     $this->assertEquals($upload2->id, $row->kwf_upload_id);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:31,代码来源:ModelTest.php

示例8: testCountSelectWhereNotEquals

 public function testCountSelectWhereNotEquals()
 {
     $s = new Kwf_Model_Select();
     $s->whereNotEquals('foo', 'aa');
     $this->assertEquals(5, $this->_m->countRows($s));
 }
开发者ID:nsams,项目名称:koala-framework,代码行数:6,代码来源:Test.php


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