[TASK] Add features to apiUtility and interfaceUtility
This commit is contained in:
parent
b33989a340
commit
a38cc25301
@ -44,7 +44,8 @@ class ApiUtility
|
||||
$queryResult,
|
||||
$additionalAttributes = [],
|
||||
$mapping = [],
|
||||
$rootRowClass = null
|
||||
$rootRowClass = null,
|
||||
$options = []
|
||||
) {
|
||||
$this->objectManager = GeneralUtility::makeInstance(
|
||||
ObjectManager::class
|
||||
@ -130,7 +131,8 @@ class ApiUtility
|
||||
$methodResult,
|
||||
$additionalAttributes[$attributeName],
|
||||
$mapping,
|
||||
$nextLevelClass
|
||||
$nextLevelClass,
|
||||
$options
|
||||
);
|
||||
if ($imageStorage) {
|
||||
foreach ($attributeResult as &$attributeResultRow) {
|
||||
@ -167,7 +169,8 @@ class ApiUtility
|
||||
[$methodResult],
|
||||
$additionalAttributes[$attributeName],
|
||||
$mapping,
|
||||
$nextLevelClass
|
||||
$nextLevelClass,
|
||||
$options
|
||||
)[0];
|
||||
$rowResult[$attributeName . 'Uid']
|
||||
= $rowResult[$attributeName]['uid'];
|
||||
@ -218,6 +221,10 @@ class ApiUtility
|
||||
}
|
||||
}
|
||||
}
|
||||
if (($options['clearIds'] ?? '' ) === true) {
|
||||
unset($rowResult['uid']);
|
||||
unset($rowResult['pid']);
|
||||
}
|
||||
$result[] = $rowResult;
|
||||
}
|
||||
return $result;
|
||||
|
||||
@ -37,4 +37,22 @@ class InterfaceUtility
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
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