Exemplo n.º 1
0
 /**
  * Edit existing path.
  *
  * @param \Innova\PathBundle\Entity\Path\Path $path
  *
  * @return \Innova\PathBundle\Entity\Path\Path
  */
 public function edit(Path $path)
 {
     // Check if JSON structure is built
     $structure = $path->getStructure();
     if (empty($structure)) {
         // Initialize path structure
         $path->initializeStructure();
     }
     // Set path as modified (= need publishing to be able to play path with new modifs)
     $path->setModified(true);
     $this->om->persist($path);
     // Update resource node if needed
     $resourceNode = $path->getResourceNode();
     if ($path->getName() !== $resourceNode->getName()) {
         // Path name as changed => rename linked resource node
         $resourceNode->setName($path->getName());
         $this->om->persist($resourceNode);
     }
     $this->om->flush();
     return $path;
 }