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


PHP Criteria::addAnd方法代碼示例

本文整理匯總了PHP中Propel\Runtime\ActiveQuery\Criteria::addAnd方法的典型用法代碼示例。如果您正苦於以下問題:PHP Criteria::addAnd方法的具體用法?PHP Criteria::addAnd怎麽用?PHP Criteria::addAnd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Propel\Runtime\ActiveQuery\Criteria的用法示例。


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

示例1: testAddAndDistinctColumns

 public function testAddAndDistinctColumns()
 {
     $table1 = "myTable1";
     $column1 = "myColumn1";
     $value1 = "myValue1";
     $key1 = "{$table1}.{$column1}";
     $table2 = "myTable2";
     $column2 = "myColumn2";
     $value2 = "myValue2";
     $key2 = "{$table2}.{$column2}";
     $this->c->add($key1, $value1, Criteria::EQUAL);
     $this->c->addAnd($key2, $value2, Criteria::EQUAL);
     $expect = "SELECT  FROM myTable1, myTable2 WHERE myTable1.myColumn1=:p1 AND myTable2.myColumn2=:p2";
     $params = array();
     $result = $this->c->createSelectSql($params);
     $expect_params = array(array('table' => 'myTable1', 'column' => 'myColumn1', 'value' => 'myValue1'), array('table' => 'myTable2', 'column' => 'myColumn2', 'value' => 'myValue2'));
     $this->assertEquals($expect, $result, 'addAnd() called on a distinct column adds a criterion to the criteria');
     $this->assertEquals($expect_params, $params, 'addAnd() called on a distinct column adds a criterion to the criteria');
 }
開發者ID:robin850,項目名稱:Propel2,代碼行數:19,代碼來源:CriteriaTest.php

示例2: getLocaleCriteria

 /**
  * @param \Generated\Shared\Transfer\LocaleTransfer $localeTransfer
  *
  * @return \Propel\Runtime\ActiveQuery\Criteria
  */
 protected function getLocaleCriteria(LocaleTransfer $localeTransfer)
 {
     $localeCriteria = new Criteria();
     $localeCriteria->addAnd(PavCmsLocalizedBlockTableMap::COL_FK_LOCALE, $localeTransfer->getIdLocale(), Criteria::EQUAL);
     $localeCriteria->_or();
     $localeCriteria->addAnd(PavCmsLocalizedBlockTableMap::COL_ID_CMS_LOCALIZED_BLOCK, null, Criteria::ISNULL);
     return $localeCriteria;
 }
開發者ID:project-a,項目名稱:spryker-cms-block,代碼行數:13,代碼來源:CmsBlockQueryContainer.php

示例3: getLocalisedAttributes

 /**
  * @param int $idLocale
  *
  * @return \Orm\Zed\Category\Persistence\SpyCategoryAttribute[]|\Propel\Runtime\Collection\ObjectCollection
  */
 public function getLocalisedAttributes($idLocale)
 {
     $criteria = new Criteria();
     $criteria->addAnd(SpyCategoryAttributeTableMap::COL_FK_LOCALE, $idLocale, Criteria::EQUAL);
     return $this->getAttributes($criteria);
 }
開發者ID:spryker,項目名稱:Category,代碼行數:11,代碼來源:AbstractSpyCategory.php


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