Пример #1
0
 /**
  * Klonira druge vire pod enoto programa
  *
  * @param entity $ep stara enota programa
  * @param entity $newEP nova enota programa
  * @param boolean $klonirajZapise
  */
 private function klonirajDrugeVire($ep, $newEP, $klonirajZapise = false)
 {
     $zs = $this->getServiceLocator()->get('zapisi.service');
     $newEP->setDrugiViri(new \Doctrine\Common\Collections\ArrayCollection());
     $collDV = $ep->getDrugiViri();
     foreach ($collDV as $dv) {
         $newDV = $dv->copy();
         $newDV->setEnotaPrograma($newEP);
         $newEP->getDrugiViri()->add($newDV);
         $this->getEm()->persist($newDV);
         $newDV->preracunaj();
         if ($klonirajZapise) {
             $zs->klonirajZapise($dv, $newDV);
         }
     }
 }