Dienstag, 23. September 2014
Joins with Typo3 Extbase
Joins mit Extbase Vers 1.0
// Erstmal: Selector erweitern:
// Selector 1 ist das aktuelle Model:
$selector1 = $query->getSource();
$selector1_JoinField = "company.postcode";
// QomFactory holen
//$qomFactory = $this->persistenceManager->getBackend()->getQOMFactory();
$backend = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Backend');
$qomFactory = $backend->getQomFactory();
// Selector 2 zusammenstellen:
$model = null;
$tableName = "postcode_test";
$selector2_JoinField = "uid";
$selector2 = $qomFactory->selector($model, $tableName);
var_dump($selector2);
// Selectoren Joinen:
$joinCondition = $qomFactory->equiJoinCondition(
$selector1->getSelectorName(), $selector1_JoinField,
$selector2->getSelectorName(), $selector2_JoinField
);
$query->setSource(
$qomFactory->join(
$selector2,
$selector1,
// For the List of Joins,visit : http://typo3.org/api/typo3cms/_query_interface_8php_source.html
\TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelConstantsInterface::JCR_JOIN_TYPE_LEFT_OUTER,
$joinCondition)
);
Abonnieren
Posts (Atom)