Skip to content
Snippets Groups Projects
Commit 13b1a98e authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Fixing category mapping bug

parent ed030950
No related branches found
No related tags found
No related merge requests found
...@@ -112,7 +112,7 @@ class MigrateNewsCommandController extends CommandController { ...@@ -112,7 +112,7 @@ class MigrateNewsCommandController extends CommandController {
public function runMigrateNewsCommand( public function runMigrateNewsCommand(
$copyPageId, $categoryPid, $year = 2015, $copyPageId, $categoryPid, $year = 2015,
$languageMapAsJson = '{"3":1,"1":0,"2":2,"0":3}', $languageMapAsJson = '{"3":1,"1":0,"2":2,"0":3}',
$categoryMapAsJson = '{"2":10,"3":11,"4":12,"5":13,"6":14,"7":15,"8":16,"9":17}', $categoryMapAsJson = '{"2":17,"3":16,"4":15,"5":14,"6":14,"7":15,"8":16,"9":17}',
$pId = 52 $pId = 52
) { ) {
// fix repair translation bug where tsfe is missing from command controller, can be removed when v1.5 is released // fix repair translation bug where tsfe is missing from command controller, can be removed when v1.5 is released
...@@ -249,23 +249,23 @@ class MigrateNewsCommandController extends CommandController { ...@@ -249,23 +249,23 @@ class MigrateNewsCommandController extends CommandController {
* Get the tag / category, matching the news * Get the tag / category, matching the news
* *
* @param array $row * @param array $row
* @return News
*/ */
private function setMatchingTag(array $row) { private function setMatchingTag(array $row) {
/** @var DatabaseConnection $db */ /** @var DatabaseConnection $db */
$db = $GLOBALS['TYPO3_DB']; $db = $GLOBALS['TYPO3_DB'];
// get content element from the original page
$where = 'uid_foreign = ' . (int) $row['uid']; $where = 'uid_foreign = ' . (int) $row['uid'];
/** @var \mysqli_result $result */ /** @var \mysqli_result $result */
$result = $db->exec_SELECTquery('uid_local', 'sys_category_record_mm_news_migration', $where); $result = $db->exec_SELECTquery('uid_local, sorting_foreign', 'sys_category_record_mm_news_migration', $where);
foreach ($result->fetch_row() as $mmRow) {
while ($mmRow = $result->fetch_assoc()) {
$values = [ $values = [
'uid_local' => $this->categoryMap[(int) $mmRow[0]], 'uid_local' => $this->categoryMap[(int) $mmRow['uid_local']],
'uid_foreign' => $this->newsPagesMap[(int) $row['uid']], 'uid_foreign' => $this->newsPagesMap[(int) $row['uid']],
'tablenames' => 'pages', 'tablenames' => 'pages',
'fieldname' => 'tx_sgnews_tags' 'fieldname' => 'tx_sgnews_tags',
'sorting_foreign' => (int) $mmRow['sorting_foreign']
]; ];
$db->exec_INSERTquery('sys_category_record_mm', $values); $db->exec_INSERTquery('sys_category_record_mm', $values);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment