[TASK] Add features to apiUtility and interfaceUtility
This commit is contained in:
parent
b33989a340
commit
a38cc25301
@ -44,7 +44,8 @@ class ApiUtility
|
|||||||
$queryResult,
|
$queryResult,
|
||||||
$additionalAttributes = [],
|
$additionalAttributes = [],
|
||||||
$mapping = [],
|
$mapping = [],
|
||||||
$rootRowClass = null
|
$rootRowClass = null,
|
||||||
|
$options = []
|
||||||
) {
|
) {
|
||||||
$this->objectManager = GeneralUtility::makeInstance(
|
$this->objectManager = GeneralUtility::makeInstance(
|
||||||
ObjectManager::class
|
ObjectManager::class
|
||||||
@ -130,7 +131,8 @@ class ApiUtility
|
|||||||
$methodResult,
|
$methodResult,
|
||||||
$additionalAttributes[$attributeName],
|
$additionalAttributes[$attributeName],
|
||||||
$mapping,
|
$mapping,
|
||||||
$nextLevelClass
|
$nextLevelClass,
|
||||||
|
$options
|
||||||
);
|
);
|
||||||
if ($imageStorage) {
|
if ($imageStorage) {
|
||||||
foreach ($attributeResult as &$attributeResultRow) {
|
foreach ($attributeResult as &$attributeResultRow) {
|
||||||
@ -167,7 +169,8 @@ class ApiUtility
|
|||||||
[$methodResult],
|
[$methodResult],
|
||||||
$additionalAttributes[$attributeName],
|
$additionalAttributes[$attributeName],
|
||||||
$mapping,
|
$mapping,
|
||||||
$nextLevelClass
|
$nextLevelClass,
|
||||||
|
$options
|
||||||
)[0];
|
)[0];
|
||||||
$rowResult[$attributeName . 'Uid']
|
$rowResult[$attributeName . 'Uid']
|
||||||
= $rowResult[$attributeName]['uid'];
|
= $rowResult[$attributeName]['uid'];
|
||||||
@ -218,6 +221,10 @@ class ApiUtility
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (($options['clearIds'] ?? '' ) === true) {
|
||||||
|
unset($rowResult['uid']);
|
||||||
|
unset($rowResult['pid']);
|
||||||
|
}
|
||||||
$result[] = $rowResult;
|
$result[] = $rowResult;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@ -37,4 +37,22 @@ class InterfaceUtility
|
|||||||
}, ARRAY_FILTER_USE_KEY);
|
}, ARRAY_FILTER_USE_KEY);
|
||||||
return array_values($constants);
|
return array_values($constants);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all interface constants per prefix
|
||||||
|
*/
|
||||||
|
public static function parseInterfaceConstantsAssoc(
|
||||||
|
$interfaceClass, $prefix
|
||||||
|
) {
|
||||||
|
$constants = (new \ReflectionClass($interfaceClass))
|
||||||
|
->getConstants();
|
||||||
|
$constants = array_filter($constants, function($key) use ($prefix) {
|
||||||
|
if (substr($key, 0, strlen($prefix) + 1)
|
||||||
|
== strtoupper($prefix) . '_'
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}, ARRAY_FILTER_USE_KEY);
|
||||||
|
return $constants;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user