当前位置: 首页>>代码示例>>PHP>>正文


PHP QueryGenerator::addReferenceModuleFieldCondition方法代码示例

本文整理汇总了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>";
开发者ID:kduqi,项目名称:corebos,代码行数:31,代码来源:testQueryGenerator.php

示例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);
            }
        }
    }
}
开发者ID:kduqi,项目名称:corebos,代码行数:31,代码来源:duplicate.php


注:本文中的QueryGenerator::addReferenceModuleFieldCondition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。