pathbuilder.php: Avoid extra sql requests
This commit is contained in:
parent
a9572e6613
commit
9a9c4539a4
1 changed files with 11 additions and 1 deletions
|
|
@ -39,11 +39,21 @@ function entity_to_xml($pathbuilderEntity) {
|
|||
// Get the paths.
|
||||
$paths = $pathbuilderEntity->getPbPaths();
|
||||
|
||||
// find out all the WisskiPathEntitys to load
|
||||
$pathEntityIDs = [];
|
||||
foreach ($paths as $key => $path) {
|
||||
$pathEntityIDs[] = $path['id'];
|
||||
}
|
||||
array_unique($pathEntityIDs);
|
||||
|
||||
// load the pathbuilder entities
|
||||
$pathEntities = WisskiPathEntity::loadMultiple($pathEntityIDs);
|
||||
|
||||
// Iterate over every path.
|
||||
foreach ($paths as $key => $path) {
|
||||
$pathbuilder = $pathbuilderEntity->getPbPath($path['id']);
|
||||
$pathChild = $xmlTree->addChild("path");
|
||||
$pathObject = WisskiPathEntity::load($path['id']);
|
||||
$pathObject = $pathEntities[$path['id']];
|
||||
|
||||
foreach ($pathbuilder as $subkey => $value) {
|
||||
if (in_array($subkey, ['relativepath'])) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue