本文整理匯總了PHP中Propel\Runtime\ActiveQuery\Criteria::containsKey方法的典型用法代碼示例。如果您正苦於以下問題:PHP Criteria::containsKey方法的具體用法?PHP Criteria::containsKey怎麽用?PHP Criteria::containsKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Propel\Runtime\ActiveQuery\Criteria
的用法示例。
在下文中一共展示了Criteria::containsKey方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testAddStringWithSchemas
/**
* Test basic adding of strings for table with explicit schema.
*/
public function testAddStringWithSchemas()
{
$table = "mySchema.myTable";
$column = "myColumn";
$value = "myValue";
// Add the string
$this->c->add($table . '.' . $column, $value);
// Verify that the key exists
$this->assertTrue($this->c->containsKey($table . '.' . $column));
// Verify that what we get out is what we put in
$this->assertTrue($this->c->getValue($table . '.' . $column) === $value);
}
示例2: extractPrimaryKey
/**
* @return array|null null if not covered by only pk
*/
public function extractPrimaryKey(Criteria $criteria)
{
$pkCols = $this->getPrimaryKeys();
if (count($pkCols) !== count($criteria->getMap())) {
return null;
}
$pk = [];
foreach ($pkCols as $pkCol) {
$fqName = $pkCol->getFullyQualifiedName();
$name = $pkCol->getName();
if ($criteria->containsKey($fqName)) {
$value = $criteria->getValue($fqName);
} else {
if ($criteria->containsKey($name)) {
$value = $criteria->getValue($name);
} else {
return null;
}
}
$pk[$name] = $value;
}
return $pk;
}