本文整理汇总了PHP中SelectQuery::hasJoinedTable方法的典型用法代码示例。如果您正苦于以下问题:PHP SelectQuery::hasJoinedTable方法的具体用法?PHP SelectQuery::hasJoinedTable怎么用?PHP SelectQuery::hasJoinedTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SelectQuery
的用法示例。
在下文中一共展示了SelectQuery::hasJoinedTable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: joinHelperTable
/**
* @return SelectQuery
**/
protected function joinHelperTable(SelectQuery $query)
{
$uc = $this->container;
if (!$query->hasJoinedTable($uc->getHelperTable())) {
$query->join($uc->getHelperTable(), Expression::eq(new DBField($uc->getParentTableIdField(), $uc->getDao()->getTable()), new DBField($uc->getChildIdField(), $uc->getHelperTable())));
}
return $query->andWhere(Expression::eq(new DBField($uc->getParentIdField(), $uc->getHelperTable()), new DBValue($uc->getParentObject()->getId())));
}
示例2: joinProperties
private function joinProperties(SelectQuery $query, ProtoDAO $parentDao, $parentTable, $parentRequired, $prefix = null)
{
$proto = call_user_func(array($parentDao->getObjectName(), 'proto'));
foreach ($proto->getPropertyList() as $property) {
if ($property instanceof LightMetaProperty && $property->getRelationId() == MetaRelation::ONE_TO_ONE && !$property->isGenericType() && (!$property->getFetchStrategyId() && $this->getFetchStrategy()->getId() == FetchStrategy::JOIN || $property->getFetchStrategyId() == FetchStrategy::JOIN)) {
if (is_subclass_of($property->getClassName(), 'Enumeration')) {
// field already added by makeSelectHead
continue;
} elseif ($property->isInner()) {
$proto = call_user_func(array($property->getClassName(), 'proto'));
foreach ($proto->getPropertyList() as $innerProperty) {
$query->get(new DBField($innerProperty->getColumnName(), $parentTable));
}
continue;
}
$propertyDao = call_user_func(array($property->getClassName(), 'dao'));
// add's custom dao's injection possibility
if (!$propertyDao instanceof ProtoDAO) {
continue;
}
$tableAlias = $propertyDao->getJoinName($property->getColumnName(), $prefix);
$fields = $propertyDao->getFields();
if (!$query->hasJoinedTable($tableAlias)) {
$logic = Expression::eq(DBField::create($property->getColumnName(), $parentTable), DBField::create($propertyDao->getIdName(), $tableAlias));
if ($property->isRequired() && $parentRequired) {
$query->join($propertyDao->getTable(), $logic, $tableAlias);
} else {
$query->leftJoin($propertyDao->getTable(), $logic, $tableAlias);
}
}
foreach ($fields as $field) {
$query->get(new DBField($field, $tableAlias), $propertyDao->getJoinPrefix($property->getColumnName(), $prefix) . $field);
}
$this->joinProperties($query, $propertyDao, $tableAlias, $property->isRequired() && $parentRequired, $propertyDao->getJoinPrefix($property->getColumnName(), $prefix));
}
}
}