本文整理汇总了PHP中QueryGenerator::addReferenceModuleFieldCondition方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryGenerator::addReferenceModuleFieldCondition方法的具体用法?PHP QueryGenerator::addReferenceModuleFieldCondition怎么用?PHP QueryGenerator::addReferenceModuleFieldCondition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryGenerator
的用法示例。
在下文中一共展示了QueryGenerator::addReferenceModuleFieldCondition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: QueryGenerator
$queryGenerator->setFields(array('id', 'firstname'));
$queryGenerator->addCondition('assigned_user_id', 'Administrator', 'e');
$query = $queryGenerator->getQuery();
echo "{$query}<br>";
testquery($query);
echo "<h2>exists condition</h2>";
$queryGenerator = new QueryGenerator('Contacts', $current_user);
$queryGenerator->setFields(array('id', 'accountname', 'firstname'));
$queryGenerator->addReferenceModuleFieldCondition('Accounts', 'account_id', 'accountname', 'EDFG Group Limited', 'exists');
$query = $queryGenerator->getQuery();
echo "{$query}<br>";
testquery($query);
echo "<h2>Query with smownerid of rel module</h2>";
$queryGenerator = new QueryGenerator("Contacts", $current_user);
$queryGenerator->setFields(array('id', 'accountname', 'Accounts.assigned_user_id'));
$queryGenerator->addReferenceModuleFieldCondition('Accounts', 'account_id', 'accountname', 'EDFG Group Limited', 'exists');
$query = $queryGenerator->getQuery();
echo "{$query}<br>";
testquery($query);
echo "<h2>Query with subject of Invoice and SO and account_id of rel module</h2>";
$queryGenerator = new QueryGenerator("Invoice", $current_user);
$queryGenerator->setFields(array('id', 'subject', 'Accounts.assigned_user_id', 'SalesOrder.subject', 'SalesOrder.account_id'));
//$queryGenerator->addReferenceModuleFieldCondition('Accounts', 'account_id', 'accountname', 'EDFG Group Limited', 'exists');
$query = $queryGenerator->getQuery();
echo "{$query}<br>";
testquery($query);
echo "<h2>Query for modules with relation on themselves</h2>";
$queryGenerator = new QueryGenerator('Accounts', $current_user);
$queryGenerator->setFields(array('id', 'accountname', 'website', 'Accounts.accountname', 'Accounts.website'));
$query = $queryGenerator->getQuery();
echo "{$query}<br>";
示例2: dup_dependent_rec
function dup_dependent_rec($record_id, $relatedModule, $new_record_id, $dependent_tables, $maped_relations)
{
global $adb, $current_user;
$invmods = getInventoryModules();
foreach ($dependent_tables as $module => $tables) {
if (in_array($module, $invmods)) {
continue;
}
// we can't duplicate these
if (empty($maped_relations) or isset($maped_relations[$module])) {
require_once "modules/" . $module . "/" . $module . ".php";
$handler = vtws_getModuleHandlerFromName($module, $current_user);
$meta = $handler->getMeta();
$related_field = $tables['columname'];
$queryGenerator = new QueryGenerator($module, $current_user);
$queryGenerator->setFields(array('id'));
$queryGenerator->addReferenceModuleFieldCondition($relatedModule, $related_field, 'id', $record_id, 'e');
$query = $queryGenerator->getQuery();
$result = $adb->pquery($query, array());
while ($r = $adb->fetch_array($result)) {
// Duplicate dependent records
$entity = new $module();
$entity->mode = '';
$entity->retrieve_entity_info($r[0], $module);
$entity->column_fields[$related_field] = $new_record_id;
$entity->column_fields = DataTransform::sanitizeRetrieveEntityInfo($entity->column_fields, $meta);
$entity->save($module);
}
}
}
}