Exemplo n.º 1
0
 /**
  * Prepare the required collections from provided test data.
  *
  * @param array|ModelIdInterface[] $siblings          List of all models.
  * @param array                    $resortingIds      Resorting ids.
  * @param int|null                 $previousModelId   Previous model ids.
  * @param CollectionInterface      $siblingCollection The sibling collection.
  * @param CollectionInterface      $modelCollection   The model collection of models being moved.
  * @param ModelIdInterface|null    $previousModel     Optional previous model.
  *
  * @return void.
  */
 protected function prepareCollections(array &$siblings, array $resortingIds, $previousModelId, $siblingCollection, $modelCollection, &$previousModel)
 {
     foreach ($siblings as $id => $sorting) {
         $model = new DefaultModel();
         $model->setID($id);
         $model->setProperty('sorting', $sorting);
         $siblingCollection->push($model);
         $siblings[$id] = $model;
         if (in_array($id, $resortingIds)) {
             $modelCollection->push($model);
         }
         if ($id === $previousModelId) {
             $previousModel = $model;
         }
     }
 }