From ae09e0123762d909e2409b8429dd8a83f68a0808 Mon Sep 17 00:00:00 2001
From: Torsten Oppermann <torsten@sgalinski.de>
Date: Mon, 23 Jul 2018 17:21:52 +0200
Subject: [PATCH] [TASK] Add pid as command controller param

---
 Classes/Command/MigrateNewsCommandController.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Classes/Command/MigrateNewsCommandController.php b/Classes/Command/MigrateNewsCommandController.php
index 38868bc..c762322 100644
--- a/Classes/Command/MigrateNewsCommandController.php
+++ b/Classes/Command/MigrateNewsCommandController.php
@@ -101,6 +101,7 @@ class MigrateNewsCommandController extends CommandController {
 	 * @param int $year only news from that year will be migrated
 	 * @param string $languageMapAsJson a json, mapping language ids (old => new). this is needed if the sys_language_uids have changed
 	 * @param string $categoryMapAsJson a json, mapping sys_category ids (old => new). t
+	 * @param $pId $year only news from that year will be migrated
 	 *
 	 * @throws IllegalObjectTypeException
 	 * @throws UnknownObjectException
@@ -109,7 +110,8 @@ class MigrateNewsCommandController extends CommandController {
 	public function runMigrateNewsCommand(
 		$copyPageId, $categoryPid, $year = 2015,
 		$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":10,"3":11,"4":12,"5":13,"6":14,"7":15,"8":16,"9":17}',
+		$pId = 52
 	) {
 		// fix repair translation bug where tsfee is missing from command controller, can be removed when v1.5 is released
 		if (!$GLOBALS['TSFE']) {
@@ -124,7 +126,7 @@ class MigrateNewsCommandController extends CommandController {
 
 		/** @var DatabaseConnection $db */
 		$db = $GLOBALS['TYPO3_DB'];
-		$where = 'hidden = 0 and deleted = 0 and endtime = 0 and pid = 52';
+		$where = 'hidden = 0 and deleted = 0 and endtime = 0 and pid = ' . (int) $pId;
 
 		/** @var \mysqli_result $result */
 		$result = $db->exec_SELECTquery('*', 'tx_news_domain_model_news', $where);
-- 
GitLab