Browse files

Refactor getting relations from collection's model

  • Loading branch information...
1 parent d3c394b commit fdd62debbf4bf43a62a9c1a6a084730fdfc16c57 @Bukarinov Bukarinov committed Dec 29, 2012
Showing with 5 additions and 6 deletions.
  1. +5 −6 library/GeometriaLab/Model/Persistent/Collection.php
View
11 library/GeometriaLab/Model/Persistent/Collection.php
@@ -19,14 +19,13 @@ public function fetchRelations($relationNames = null, $refresh = false)
return $this;
}
- foreach ($relations as $relation) {
- /* @var \GeometriaLab\Model\Persistent\Relation\AbstractRelation $relation */
- $relationNames[$relation->getProperty()->getName()] = null;
- }
- } else {
- $relationNames = $this->parseRelationNames($relationNames);
+ $relationNames = array_map(function($relation) {
+ return null;
+ }, $relations);
}
+ $relationNames = $this->parseRelationNames($relationNames);
+
foreach ($relationNames as $relationName => $childRelations) {
$relation = $this->getRelation($relationName);
if ($relation !== null) {

0 comments on commit fdd62de

Please sign in to comment.