本文整理汇总了PHP中SugarBean::get_custom_table_name方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarBean::get_custom_table_name方法的具体用法?PHP SugarBean::get_custom_table_name怎么用?PHP SugarBean::get_custom_table_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarBean
的用法示例。
在下文中一共展示了SugarBean::get_custom_table_name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compileFrom
/**
* Create a from statement
*
* @param SugarBean|array $bean
* @return string
*/
protected function compileFrom($bean)
{
$alias = "";
$return = array();
if (is_array($bean)) {
list($bean, $alias) = $bean;
$this->from_alias = $alias;
}
$this->from_bean = $bean;
$table = $bean->getTableName();
$table_cstm = '';
$from_clause = "{$table}";
if (!empty($alias)) {
$from_clause .= " {$alias}";
}
//SugarQuery will determine if we actually need to add the table or not.
$this->sugar_query->joinCustomTable($bean, $alias);
if (!empty($this->from_alias)) {
$this->primary_table = $this->from_alias;
$this->primary_custom_table = $this->from_alias . '_c';
} else {
$this->primary_table = $this->from_bean->getTableName();
$this->primary_custom_table = $this->from_bean->get_custom_table_name();
}
$return = $from_clause;
return $return;
}
示例2: array
function build_report_query_join($name, $alias, $parentAlias, SugarBean $module, $type, $query = array(), SugarBean $rel_module = null)
{
if (!isset($query['join'][$alias])) {
switch ($type) {
case 'custom':
$query['join'][$alias] = 'LEFT JOIN ' . $this->db->quoteIdentifier($module->get_custom_table_name()) . ' ' . $this->db->quoteIdentifier($name) . ' ON ' . $module->table_name . '.id = ' . $this->db->quoteIdentifier($name) . '.id_c ';
break;
case 'relationship':
if ($module->load_relationship($name)) {
$params['join_type'] = 'LEFT JOIN';
if ($module->{$name}->relationship_type != 'one-to-many') {
if ($module->{$name}->getSide() == REL_LHS) {
$params['right_join_table_alias'] = $this->db->quoteIdentifier($alias);
$params['join_table_alias'] = $this->db->quoteIdentifier($alias);
$params['left_join_table_alias'] = $this->db->quoteIdentifier($parentAlias);
} else {
$params['right_join_table_alias'] = $this->db->quoteIdentifier($parentAlias);
$params['join_table_alias'] = $this->db->quoteIdentifier($alias);
$params['left_join_table_alias'] = $this->db->quoteIdentifier($alias);
}
} else {
$params['right_join_table_alias'] = $this->db->quoteIdentifier($parentAlias);
$params['join_table_alias'] = $this->db->quoteIdentifier($alias);
$params['left_join_table_alias'] = $this->db->quoteIdentifier($parentAlias);
}
$linkAlias = $parentAlias . "|" . $alias;
$params['join_table_link_alias'] = $this->db->quoteIdentifier($linkAlias);
$join = $module->{$name}->getJoin($params, true);
$query['join'][$alias] = $join['join'];
if ($rel_module != null) {
$query['join'][$alias] .= $this->build_report_access_query($rel_module, $name);
}
$query['select'][] = $join['select'] . " AS '" . $alias . "_id'";
}
break;
default:
break;
}
}
return $query;
}
示例3: array
function build_report_query_join($name, SugarBean $module, $type, $query = array())
{
if (!isset($query['join'][$name])) {
switch ($type) {
case 'custom':
$query['join'][$name] = 'LEFT JOIN ' . $module->get_custom_table_name() . ' ' . $name . ' ON ' . $module->table_name . '.id = ' . $name . '.id_c ';
break;
case 'relationship':
if ($module->load_relationship($name)) {
$params['join_type'] = 'LEFT JOIN';
$params['join_table_alias'] = $name;
$join = $module->{$name}->getJoin($params, true);
$query['join'][$name] = $join['join'];
$query['select'][] = $join['select'] . " AS '" . $name . "_id'";
}
break;
default:
break;
}
}
return $query;
}
示例4: joinCustomTable
/**
* Joins the custom table to the current query (if possible)
* @param SugarBean $bean
* @param string $alias
*/
public function joinCustomTable($bean, $alias = "")
{
if ($bean->hasCustomFields() && !$this->customJoined) {
$table = $bean->getTableName();
$table_cstm = $bean->get_custom_table_name();
if (!empty($table_cstm)) {
// TODO: CLEAN THIS UP
if (!empty($alias)) {
$sql = "LEFT JOIN {$table_cstm} {$alias}_c ON {$alias}_c.id_c = {$alias}.id";
} else {
$sql = "LEFT JOIN {$table_cstm} ON {$table_cstm}.id_c = {$table}.id";
}
// can do a join here because we haven't got to the joins yet in the compile sequence.
$this->joinRaw($sql);
}
}
}