Exemplo n.º 1
0
 /**
  * Clean steps which no long exist in the current path
  * @param  array                                        $neededSteps
  * @param  array                                        $existingSteps
  * @return \Innova\PathBundle\Manager\PublishingManager
  */
 protected function cleanSteps(array $neededSteps = array(), array $existingSteps = array())
 {
     $toRemove = array_filter($existingSteps, function (Step $current) use($neededSteps) {
         $removeStep = true;
         foreach ($neededSteps as $step) {
             if ($current->getId() == $step->getId()) {
                 $removeStep = false;
                 break;
             }
         }
         return $removeStep;
     });
     foreach ($toRemove as $stepToRemove) {
         $this->path->removeStep($stepToRemove);
         $this->om->remove($stepToRemove);
     }
     return $this;
 }