Change-Id: Icf785d1c79d739fff70aeed8e7745cfedc3993ac
Resolves: #80676
Releases: master
Reviewed-on: https://review.typo3.org/52357
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Thomas Hohn <thomas@hohn.dk>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: TYPO3com <no-reply@typo3.com>
Tested-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
* The TYPO3 project - inspiring people to share!
*/
* The TYPO3 project - inspiring people to share!
*/
+use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
*/
public function setParent($parent)
{
*/
public function setParent($parent)
{
- $this->parent = $parent;
+ $this->parent = $this->extractId($parent);
*/
public function setSource($source)
{
*/
public function setSource($source)
{
- $this->source = $source;
+ $this->source = $this->extractId($source);
+ /**
+ * Extracts real id from provided id-value, which can either be a real
+ * integer value, a 'NEW...' id, or a combined identifier 'tt_content_13'.
+ *
+ * @param int|string $idValue
+ * @return int|string
+ */
+ protected function extractId($idValue)
+ {
+ if (MathUtility::canBeInterpretedAsInteger($idValue)) {
+ return $idValue;
+ } elseif (strpos($idValue, 'NEW') === 0) {
+ return $idValue;
+ } else {
+ // @todo Handle if $tableName does not match $this->tableName
+ list($tableName, $id) = BackendUtility::splitTable_Uid($idValue);
+ return $id;
+ }
+ }
+
/**
* @return null|State
*/
/**
* @return null|State
*/