234 for ($i = 0; $i <
$classMap->getReferenceSize(); $i++)
236 $am =
$classMap->getReferenceAttributeMap($i);
238 if ($cm = $am->getColumnMap())
240 $crm = $am->getReference()->getColumnMap();
241 $t1 = $cm->getTableMap();
243 $t1Name = $t1->getName() .
' ' . $t1Alias;
244 $t2 = $crm->getTableMap();
246 $t2Name = $t2->getName() .
' ' . $t2Alias;
247 $condition = $cm->getFullyQualifiedName($t1Alias) .
"=" . $crm->getFullyQualifiedName($t2Alias);
248 $join[] = array($t1Name, $t2Name, $condition,
'INNER');
256 if ($this->classMap->getJoinAssociationSize())
258 foreach($this->classMap->getJoinAssociationMaps() as $aMap)
260 $this->_addAssociation($aMap->getTargetName(),$this->classMap, $aMap,
'', $aMap->getJoinAutomatic());
265 $n = count($this->associations);
269 foreach ($this->associations as $association)
271 $aMap = $association->getAssociationMap();
272 $type = strtoupper($association->getJoinType());
273 $k = $aMap->getSize();
275 for ($j = 0; $j < $k; $j++)
277 $entry = $aMap->getEntry($j);
278 $t1 = $entry->getFrom()->getColumnMap()->getTableMap();
279 $t1Alias = ($aMap->IsInverse() ? $association->getAlias() : $this->
getTableAlias($t1));
280 $t1Name = $t1->getName() .
' ' . $t1Alias;
281 $t2 = $entry->getTo()->getColumnMap()->getTableMap();
282 $t2Alias = (!$aMap->IsInverse() ? $association->getAlias() : $this->
getTableAlias($t2));
283 $t2Name = $t2->getName() .
' ' . $t2Alias;
285 if ($aMap->IsInverse())
287 $condition = $entry->getTo()->getColumnMap()->getFullyQualifiedName($t2Alias) .
"=" . $entry->getFrom()->getColumnMap()->getFullyQualifiedName($t1Alias);
288 $join[] = array($t2Name, $t1Name, $condition, $type);
292 $condition = $entry->getFrom()->getColumnMap()->getFullyQualifiedName($t1Alias) .
"=" . $entry->getTo()->getColumnMap()->getFullyQualifiedName($t2Alias);
293 $join[] = array($t1Name, $t2Name, $condition, $type);
299 return (count($join) ? $join : NULL);
307 if (strpos($attribute,
'.'))
309 $tok = strtok($attribute,
".");
313 $nameSequence[] = $tok;
317 for ($i = 0; $i < count($nameSequence) - 1; $i++)
319 $name = $nameSequence[$i];
320 $isAlias = $this->
isAlias($name);
324 $cm = $this->aliasTable[$name];
335 $cm = $am->getForClass();
341 $attribute = $nameSequence[count($nameSequence) - 1];
342 $map = $cm->getAttributeMap($attribute, TRUE);
348 $attribute = $name .
'.' . $attribute;
352 $attribute = implode(
'.', $nameSequence);
359 $map = $cm->getAttributeMap($attribute, TRUE);
361 if (($map != NULL) && ($this->alias !=
''))
362 $attribute = $this->alias .
'.' . $attribute;
463 $am =
$classMap->getAssociationMap($associationName);
464 if ($inverse !== NULL)
466 $am->SetInverse($inverse);
471 $cardinality = $am->getCardinality();
473 if ($cardinality ==
'manyToMany')
475 $direction = $am->getDirection();
481 $this->_addAssociation($associationName,
$classMap, $am);
486 if (($cm = $am->getForClass()) != NULL)