本文整理汇总了PHP中KTUtil::whereToString方法的典型用法代码示例。如果您正苦于以下问题:PHP KTUtil::whereToString方法的具体用法?PHP KTUtil::whereToString怎么用?PHP KTUtil::whereToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KTUtil
的用法示例。
在下文中一共展示了KTUtil::whereToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeSetsFromDocumentType
/**
* Removes a non-generic fieldset from a given document type.
*
* (Generic fieldsets are made available to and are required for all
* (subsequent) documents. Non-generic fieldsets are made available
* to and are required for all (subsequent) documents that have a
* particular document type.)
*/
function removeSetsFromDocumentType($oDocumentType, $aFieldsets)
{
if (is_object($oDocumentType)) {
$iDocumentTypeId = $oDocumentType->getId();
} else {
$iDocumentTypeId = $oDocumentType;
}
if (!is_array($aFieldsets)) {
$aFieldsets = array($aFieldsets);
}
if (empty($aFieldsets)) {
return true;
}
$aIds = array();
foreach ($aFieldsets as $oFieldset) {
if (is_object($oFieldset)) {
$iFieldsetId = $oFieldset->getId();
} else {
$iFieldsetId = $oFieldset;
}
$aIds[] = $iFieldsetId;
}
// Converts to (?, ?, ?) for query
$sParam = DBUtil::paramArray($aIds);
$aWhere = KTUtil::whereToString(array(array('document_type_id = ?', array($iDocumentTypeId)), array("fieldset_id IN ({$sParam})", $aIds)));
$sTable = KTUtil::getTableName('document_type_fieldsets');
$aQuery = array("DELETE FROM {$sTable} WHERE {$aWhere[0]}", $aWhere[1]);
return DBUtil::runQuery($aQuery);
}
示例2: array
<?php
require_once "../../../config/dmsDefaults.php";
require_once KT_LIB_DIR . "/util/ktutil.inc";
$aSource = array(array("active = ?", array(true)), array("foo = ? AND asdf = ?", array(5, "ff")));
$aResults = KTUtil::whereToString($aSource);
$aExpectedResults = array("active = ? AND foo = ? AND asdf = ?", array(true, 5, "ff"));
if ($aResults === $aExpectedResults) {
print "Success!\n";
} else {
print "Failure!\n";
print "Received: " . print_r($aResults, true) . "\n";
print "Expected: " . print_r($aExpectedResults, true) . "\n";
}
示例3: listGroups
function listGroups($aGivenOptions = null)
{
if (is_null($aGivenOptions)) {
$aGivenOptions = array();
}
$aDefaultOptions = array();
$aOptions = kt_array_merge($aDefaultOptions, $aGivenOptions);
$aWhere = array();
/* if ($aOptions["active"] === true) {
$aWhere[] = array("active = ?", true);
} */
$sWhere = KTUtil::whereToString($aWhere);
return Group::getList($sWhere);
}