{"action":"created","issue":{"url":"https://api.github.com/repos/FluidTYPO3/flux/issues/1319","repository_url":"https://api.github.com/repos/FluidTYPO3/flux","labels_url":"https://api.github.com/repos/FluidTYPO3/flux/issues/1319/labels{/name}","comments_url":"https://api.github.com/repos/FluidTYPO3/flux/issues/1319/comments","events_url":"https://api.github.com/repos/FluidTYPO3/flux/issues/1319/events","html_url":"https://github.com/FluidTYPO3/flux/issues/1319","id":206812957,"number":1319,"title":"Flux\\Configuration\\BackendConfigurationManager:getPageIdFromRecordIdentifiedInEditUrlArgument returns wrong id","user":{"login":"wazum","id":146727,"avatar_url":"https://avatars.githubusercontent.com/u/146727?v=3","gravatar_id":"","url":"https://api.github.com/users/wazum","html_url":"https://github.com/wazum","followers_url":"https://api.github.com/users/wazum/followers","following_url":"https://api.github.com/users/wazum/following{/other_user}","gists_url":"https://api.github.com/users/wazum/gists{/gist_id}","starred_url":"https://api.github.com/users/wazum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wazum/subscriptions","organizations_url":"https://api.github.com/users/wazum/orgs","repos_url":"https://api.github.com/users/wazum/repos","events_url":"https://api.github.com/users/wazum/events{/privacy}","received_events_url":"https://api.github.com/users/wazum/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-02-10T14:42:29Z","updated_at":"2017-02-12T09:01:37Z","closed_at":null,"body":"This method called `getPageIdFromRecordUid` even if the edit command ID (like edit[tt_content][44733]=new) was positive and therefore already the page ID, so in fact returning a random value found by querying a < table > record with this (page) ID as uid.\r\n\r\nThe following patch fixes this issue:\r\n\r\n```\r\ndiff --git a/Classes/Configuration/BackendConfigurationManager.php b/Classes/Configuration/BackendConfigurationManager.php\r\nindex e2245924..dcc5f9cb 100644\r\n--- a/Classes/Configuration/BackendConfigurationManager.php\r\n+++ b/Classes/Configuration/BackendConfigurationManager.php\r\n@@ -121,7 +121,9 @@ class BackendConfigurationManager extends CoreBackendConfigurationManager implem\r\n         } elseif (0 <> $id && 'pages' !== $table) {\r\n             // if any identified record is being edited, load it and return the PID value.\r\n             // if the (new) record is relative to another, $id is negative UID of relative record, hence abs().\r\n-            return $this->getPageIdFromRecordUid($table, abs($id));\r\n+            if (0 > $id && 'new' === $command) {\r\n+                return $this->getPageIdFromRecordUid($table, abs($id));\r\n+            }\r\n         }\r\n         return $id;\r\n     }\r\n@@ -147,9 +149,6 @@ class BackendConfigurationManager extends CoreBackendConfigurationManager implem\r\n         $argumentPair = reset($editArgument);\r\n         $id = (integer) key($argumentPair);\r\n         $command = reset($argumentPair);\r\n-        // if TYPO3 wants to insert a new tt_content element after the element\r\n-        // with uid=abs($id), translate ID.\r\n-        $id = (integer) (0 > $id && 'tt_content' === $table) ? $id = -$id : $id;\r\n         return [$table, $id, $command];\r\n     }\r\n\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/FluidTYPO3/flux/issues/comments/279205460","html_url":"https://github.com/FluidTYPO3/flux/issues/1319#issuecomment-279205460","issue_url":"https://api.github.com/repos/FluidTYPO3/flux/issues/1319","id":279205460,"user":{"login":"wazum","id":146727,"avatar_url":"https://avatars.githubusercontent.com/u/146727?v=3","gravatar_id":"","url":"https://api.github.com/users/wazum","html_url":"https://github.com/wazum","followers_url":"https://api.github.com/users/wazum/followers","following_url":"https://api.github.com/users/wazum/following{/other_user}","gists_url":"https://api.github.com/users/wazum/gists{/gist_id}","starred_url":"https://api.github.com/users/wazum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wazum/subscriptions","organizations_url":"https://api.github.com/users/wazum/orgs","repos_url":"https://api.github.com/users/wazum/repos","events_url":"https://api.github.com/users/wazum/events{/privacy}","received_events_url":"https://api.github.com/users/wazum/received_events","type":"User","site_admin":false},"created_at":"2017-02-12T09:01:37Z","updated_at":"2017-02-12T09:01:37Z","body":"This was not the whole story, it requires another condition, if the command is not 'new' (then it's the record ID again)\r\n\r\n```\r\n            if (0 > $id && 'new' === $command) {\r\n                return $this->getPageIdFromRecordUid($table, abs($id));\r\n            }\r\n            elseif (0 < $id && 'new' !== $command) {\r\n                return $this->getPageIdFromRecordUid($table, abs($id));\r\n            }\r\n```"}}
{"actor":{"display_login":"wazum"}}