Example #1
0
 /**
  * Creates a new project from an existing template
  * 
  * @return ProjectManager
  */
 public function createProjectFromTemplate(Project $project)
 {
     // copy from this template
     $template = $this->repo->find($project->getCopiedFrom());
     $this->em->persist($project);
     // copy phases from template
     foreach ($template->getPhases() as $tplPhase) {
         $phase = new Phase();
         $phase->copyFrom($tplPhase)->setProject($project);
         $this->em->persist($phase);
     }
     $this->em->flush();
 }
Example #2
0
 /**
  * Copy relevant data from an existing phase
  * 
  * @param Phase $phase
  * @return Phase
  */
 public function copyFrom(Phase $phase)
 {
     $this->setName($phase->getName())->setPreviousPhaseId($phase->getPreviousPhaseId());
     return $this;
 }