mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-19 04:58:41 +00:00
Added more array selectors
This commit is contained in:
parent
e193a42007
commit
354ca75009
|
|
@ -1413,6 +1413,30 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate data.
|
||||
*
|
||||
* @param array $result Result set
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function populateIterableArray(array $result) : array
|
||||
{
|
||||
$row = [];
|
||||
|
||||
foreach ($result as $element) {
|
||||
if (isset($element[static::$primaryField])) {
|
||||
$row[$element[static::$primaryField]] = self::populateAbstractArray($element);
|
||||
} else {
|
||||
$row[] = self::populateAbstractArray($element);
|
||||
}
|
||||
}
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate data.
|
||||
*
|
||||
|
|
@ -1969,6 +1993,29 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object.
|
||||
*
|
||||
* @param int $relations Load relations
|
||||
* @param string $lang Language
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function getAllArray(int $relations = RelationType::ALL, string $lang = '') : array
|
||||
{
|
||||
if(!isset(self::$parentMapper)) {
|
||||
self::setUpParentMapper();
|
||||
}
|
||||
|
||||
$obj = self::populateIterableArray(self::getAllRaw($lang));
|
||||
self::fillRelationsArray($obj, $relations);
|
||||
self::clear();
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find data.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user