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


PHP Condition::EQA方法代码示例

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


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

示例1: Query

<pre>
<?php 
include_once "core.db.criteria2.Condition.class.php";
include_once "core.db.criteria2.ComplexCondition.class.php";
include_once "core.db.criteria2.CompareCondition.class.php";
include_once "core.db.criteria2.BinaryInfixCondition.class.php";
include_once "core.db.criteria2.UnaryPrefixCondition.class.php";
include_once "core.db.criteria2.Query.class.php";
include_once "core.db.criteria2.Select.class.php";
include_once "../core.db.DatabaseMySQL.class.php";
$q = new Query();
$q->addFrom('Persona', 'p')->addFrom('Empleado', 'e')->setCondition(Condition::_AND()->add(Condition::EQ('p', "nombre", "Carlos"))->add(Condition::GT('p', "edad", 5))->add(Condition::EQA('p', "nombre", 'p', "nombre2")));
$db = new DatabaseMySQL();
echo $db->evaluateQuery($q);
//echo Condition::EQ("per", "nombre", "Carlox")->evaluate();
//echo Condition::EQA("per", "nombre", "per", "nombre2")->evaluate();
/*
$sel = new Select();

$sel->addProjection("per", "name");
$sel->addProjection("per", "age");
$sel->addAvg("per", "age");
echo $sel->evaluate();
*/
$q = new Query();
$q->addAggregation(SelectAggregation::AGTN_DISTINTC, 'datos', 'nombre')->addFrom('Persona', 'datos')->setCondition(Condition::GT('p', "edad", 5));
echo $db->evaluateQuery($q);
?>
</pre>
开发者ID:fkali,项目名称:yupp,代码行数:29,代码来源:QueryTest.php

示例2: findHasManyReverse

 /**
  * Devuelve una lista de $searchClass, tal que:
  * 1. $searchClass tiene un atributo hasMany $hasManyAttr a la clase $byClass
  * 2. $searchClass tiene una instancia de $byClass en $hasManyAttr con $byId
  */
 public function findHasManyReverse($searchClass, $hasManyAttr, $byClass, $byId)
 {
     $sins = new $searchClass(array(), true);
     // PHP 5.3
     if (!$sins->hasAttribute($hasManyAttr)) {
         throw new Exception("El atributo hasMany {$hasManyAttr} no existe");
     }
     // tabla de join
     $relins = new $byClass(array(), true);
     $joinTableName = YuppConventions::relTableName($sins, $hasManyAttr, $relins);
     // tabla de esta clase
     $objTableName = YuppConventions::tableName($sins);
     // quiero owner_id de la tabla de join, por byId
     // luego hacer join con la tabla de $this
     //$cond = Condition::EQ($joinTableName, "byId", $byId);
     // similar PM.get_many_assoc_lazy
     YuppLoader::load('core.db.criteria2', 'Query');
     $q = new Query();
     $q->addFrom($joinTableName, 'ref')->addFrom($objTableName, 'obj')->addProjection('obj', '*')->setCondition(Condition::_AND()->add(Condition::EQA('obj', 'id', 'ref', 'owner_id'))->add(Condition::EQ('ref', 'ref_id', $byId)));
     $data = $this->findByQuery($q);
     // PM 760
     $result = array();
     foreach ($data as $many_attrValues) {
         if ($many_attrValues['class'] === $byClass) {
             //echo "   la clase es la misma que la declarada<br/>";
             $rel_obj = $this->createObjectFromData($byClass, $many_attrValues);
         } else {
             //echo "   la clase NO es la misma que la declarada<br/>";
             $rel_obj = $this->get_mti_object_byData($byClass, $many_attrValues);
         }
         $result[] = $rel_obj;
     }
     return $result;
 }
开发者ID:fkali,项目名称:yupp,代码行数:39,代码来源:core.persistent.PersistentManager.class.php


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