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


PHP Condition類代碼示例

本文整理匯總了PHP中Condition的典型用法代碼示例。如果您正苦於以下問題:PHP Condition類的具體用法?PHP Condition怎麽用?PHP Condition使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: obtenirTout

 public static function obtenirTout(Condition $conditions = NULL, $offset = 0, $limite = NULL)
 {
     $listeRecords = ORM::forTable(self::nomTable());
     // Prise en compte d'éventuelles conditions
     if ($conditions !== NULL) {
         $listeRecords->whereRaw($conditions->generer(), $conditions->listeValeurs());
     }
     // Pris en compte de l'éventuel limite
     if ($limite !== NULL) {
         $listeRecords->limit($limite);
     }
     // Prise en compte de l'éventuel offset
     $listeRecords->offset($offset);
     // Récupération des résultats
     $listeRecords = $listeRecords->findMany();
     $listeElements = array();
     // On récupère le nom de la classe instanciée pour pouvoir en retourner les objets
     $nomClasse = get_called_class();
     foreach ($listeRecords as $record) {
         $objet = new $nomClasse();
         // Hydration de l'objet
         $objet->setRecord($record);
         // Ajout dans la liste des résultats
         $listeElements[] = $objet;
     }
     return $listeElements;
 }
開發者ID:RedaB,項目名稱:PHPBase,代碼行數:27,代碼來源:ModeleBase.class.php

示例2: testValidateOperator

 function testValidateOperator()
 {
     $c = new Condition();
     $c->add('foo', 'bar', 'SQL injection!');
     $this->setExpectedException('InvalidArgumentException');
     $stmnt = $c->getQueryStatement();
     $stmnt->setConnection(DBManager::getConnection());
 }
開發者ID:abcarroll,項目名稱:DABL,代碼行數:8,代碼來源:ConditionTest.php

示例3: getTelefones

 public function getTelefones()
 {
     $condition = new Condition();
     $condition->addFilter("pessoa_id = '" . $this->id . "'");
     $telefoneTable = new TelefoneTable();
     $telefones = $telefoneTable->get($condition);
     return $telefones;
 }
開發者ID:BGCX067,項目名稱:facsis-hg-to-git,代碼行數:8,代碼來源:Helper.class.php

示例4: doesNotContain

 public function doesNotContain($string)
 {
     $rep = Condition::stringOf($string);
     return $this->isNot(new Match(function ($value) use($string) {
         return false !== strpos($value, $string);
     }, ['%s does not contain ' . $rep, '%s contains ' . $rep]));
 }
開發者ID:xp-forge,項目名稱:assert,代碼行數:7,代碼來源:StringAssertions.class.php

示例5: evaluatedValue

 protected function evaluatedValue(Condition $condition)
 {
     if (!$this->state) {
         return 'unknown';
     }
     $value = $condition->evaluate($this->state);
     if ($value instanceof Yes) {
         return 'true';
     } elseif ($value instanceof No) {
         return 'false';
     } elseif ($value instanceof Maybe) {
         return 'maybe';
     } else {
         return 'undefined';
     }
 }
開發者ID:Nr90,項目名稱:kennissysteem,代碼行數:16,代碼來源:formatter.php

示例6: checkCondition

 /**
  * [checkCondition description]
  * @param  [type] $cond [description]
  * @return [type]       [description]
  */
 public function checkCondition($cond)
 {
     $rs = Condition::where('cond_name', '=', $cond)->count();
     if (isset($rs)) {
         return $rs >= 1 ? false : true;
     }
 }
開發者ID:nattaphat,項目名稱:cuse2,代碼行數:12,代碼來源:Condition.php

示例7: queryAction

 public function queryAction()
 {
     $q = new Query();
     $q->addAggregation(SelectAggregation::AGTN_DISTINTC, 'p', 'nombre')->addFrom('hello_world_persona', 'p')->setCondition(Condition::GT('p', "edad", 25));
     $pm = PersistentManager::getInstance();
     $result = $pm->findByQuery($q);
     return $this->renderString(print_r($result, true));
 }
開發者ID:fkali,項目名稱:yupp,代碼行數:8,代碼來源:apps.helloWorld.controllers.PersonaController.class.php

示例8: getView

 public function getView($slug)
 {
     $game = $this->getModelFromSlug($slug);
     $products = $game->products()->orderBy('created_at', 'DESC')->get();
     $platforms = Platform::all();
     $conditions = Condition::all();
     return View::make('site/game/view_game', compact('game', 'products', 'platforms', 'conditions'));
 }
開發者ID:adriacidre,項目名稱:gamereuse,代碼行數:8,代碼來源:GameController.php

示例9: removeCondition

 public function removeCondition(Condition $condition = null)
 {
     if ($condition) {
         if ($this->condition) {
             $this->condition->removeCondition($condition);
         }
     } else {
         $this->condition = null;
     }
 }
開發者ID:saiber,項目名稱:www,代碼行數:10,代碼來源:ARFilter.php

示例10: _argToCondition

 protected function _argToCondition($arg)
 {
     if (!$arg instanceof Condition) {
         $arg = Condition::create($arg);
         if ($this->_prefix) {
             $arg->setPrefix($this->_prefix);
         }
     }
     return $arg;
 }
開發者ID:Ekhvalov,項目名稱:recordsman,代碼行數:10,代碼來源:Condition.php

示例11: applyOn

 /**
  * Apply this JOIN statement on given query
  * @param array $query Query to apply JOIN on
  * @return void
  */
 public function applyOn(array &$query)
 {
     $query[] = sprintf('%s %%n %%n', $this->type);
     $query[] = $this->table;
     $query[] = $this->name ?: $this->table;
     if (!empty($this->conditions)) {
         $query[] = 'ON';
         Condition::applyListOn($query, $this->conditions);
     }
 }
開發者ID:tatarko,項目名稱:dibi-active-record,代碼行數:15,代碼來源:Join.php

示例12: __getCondition

 /**
  * @param string $value
  * @return Condition
  * @throws \Exception
  * @internal
  */
 public function __getCondition($value)
 {
     if ($this->where === NULL && is_string($this->condition)) {
         list(, $from, $to) = \Nette\Utils\Strings::match($value, $this->mask);
         $from = \DateTime::createFromFormat($this->dateFormatInput, trim($from));
         $to = \DateTime::createFromFormat($this->dateFormatInput, trim($to));
         $values = $from && $to ? array($from->format($this->dateFormatOutput), $to->format($this->dateFormatOutput)) : NULL;
         return $values ? Condition::setup($this->getColumn(), $this->condition, $values) : Condition::setupEmpty();
     }
     return parent::__getCondition($value);
 }
開發者ID:cujan,項目名稱:atlashornin,代碼行數:17,代碼來源:DateRange.php

示例13: testCondition

 public function testCondition()
 {
     $params = array();
     $f = new Field('test');
     $arr = array(1, 2, 3, 4, 5);
     $c = new Condition('in', $f, $arr);
     $this->assertEquals('`t0`.`test` IN (1, 2, 3, 4, 5)', $c->getSql($params));
     $this->assertEquals('in', $c->getComparison());
     $this->assertEquals(var_export($f, true), var_export($c->getLeft(), true));
     $this->assertEquals(var_export($arr, true), var_export($c->getRight(), true));
     try {
         $c = new Condition('in', new Field('test'), 'error');
         $this->fail('second parameter shoud be array-only, but string passed');
     } catch (InvalidArgumentException $e) {
     }
     try {
         $c = new Condition('in', new Field('test'), array('a'));
         $this->fail('second parameter shoud be array of integets, but array of strings passed');
     } catch (InvalidArgumentException $e) {
     }
 }
開發者ID:NinjaKC,項目名稱:MySQL-Query-Builder,代碼行數:21,代碼來源:OtherTest.php

示例14: ConditionWithoutArgument

 /**
  * constructor
  * @param string $column_name
  * @param mixed $argument
  * @param string $operation
  * @param string $pipe
  * @return void
  */
 function ConditionWithoutArgument($column_name, $argument, $operation, $pipe = "")
 {
     parent::Condition($column_name, $argument, $operation, $pipe);
     $tmpArray = array('in' => 1, 'notin' => 1, 'not_in' => 1);
     if (isset($tmpArray[$operation])) {
         if (is_array($argument)) {
             $argument = implode($argument, ',');
         }
         $this->_value = '(' . $argument . ')';
     } else {
         $this->_value = $argument;
     }
 }
開發者ID:kimkucheol,項目名稱:xe-core,代碼行數:21,代碼來源:ConditionWithoutArgument.class.php

示例15: __getCondition

 /**
  * @param string $value
  * @return Condition|bool
  * @throws \Exception
  * @internal
  */
 public function __getCondition($value)
 {
     $condition = parent::__getCondition($value);
     if ($condition === NULL) {
         $condition = Condition::setupEmpty();
         if (preg_match('/(<>|[<|>]=?)?([-0-9,|.]+)/', $value, $matches)) {
             $value = str_replace(',', '.', $matches[2]);
             $operator = $matches[1] ? $matches[1] : '=';
             $condition = Condition::setup($this->getColumn(), $operator . ' ?', $value);
         }
     }
     return $condition;
 }
開發者ID:Kaliver,項目名稱:grido,代碼行數:19,代碼來源:Number.php


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