Skip to content

Commit

Permalink
Merge pull request #165 from nextras/pr/persistence_helper_improvements
Browse files Browse the repository at this point in the history
Pr/persistence helper improvements
  • Loading branch information
hrach committed Mar 15, 2016
2 parents 0f347b4 + 5205e20 commit 40582c4
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/Repository/PersistenceHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,24 @@ class PersistenceHelper
*/
public static function getCascadeQueue(IEntity $entity, IModel $model, $withCascade)
{
self::$inputQueue = [];
self::$outputQueue = [];
self::visitEntity($entity, $model, $withCascade);
try {
self::visitEntity($entity, $model, $withCascade);

for ($i = 0; $i < count(self::$inputQueue); $i++) {
$value = self::$inputQueue[$i];
if ($value instanceof IEntity) {
self::visitEntity($value, $model);
} else {
self::visitRelationship($value, $model);
}
}

for ($i = 0; $i < count(self::$inputQueue); $i++) {
$value = self::$inputQueue[$i];
return self::$outputQueue;

if ($value instanceof IEntity) {
self::visitEntity($value, $model);
} else {
self::visitRelationship($value, $model);
}
} finally {
self::$inputQueue = [];
self::$outputQueue = [];
}

return self::$outputQueue;
}


Expand Down

0 comments on commit 40582c4

Please sign in to comment.