本文整理汇总了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');
}
示例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;
}
示例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);
}