コード例 #1
0
 protected function saveBlock(Block $formBlock, $timetable)
 {
     if (empty($this->block)) {
         $this->block = new Block();
         $this->block->setTitle($formBlock->getTitle());
         $this->block->setContent($formBlock->getContent());
         $this->block->setTypeId($formBlock->getTypeId());
         $this->block->setDomId($formBlock->getDomId());
     }
     // we need to init the relations even if the block is already filled with the post values
     // because stop_point_id in post contains the navitiaId value and doctrine expects a bdd ID
     // Plus, init Relations updates modified dates of line entity or stopPoint
     $this->initRelation($formBlock, $timetable);
     $this->om->persist($this->block);
     $this->om->flush();
 }
コード例 #2
0
 public function copy(Block $origBlock, Block $destBlock, $destTimetable)
 {
     $origImgMediaPath = $this->findMediaPathByTimeTable($origBlock->getTimetable(), $origBlock->getDomId());
     if (!empty($origImgMediaPath)) {
         copy($origImgMediaPath, $origImgMediaPath . '.bak');
         $destMedia = $this->saveByTimetable($destTimetable, new File($origImgMediaPath), $origBlock->getDomId());
         $destBlock->setContent($this->mediaDataCollector->getUrlByMedia($destMedia));
         // no rename because of the NFS bug
         copy($origImgMediaPath . '.bak', $origImgMediaPath);
         unlink($origImgMediaPath . '.bak');
     }
 }