/**
  * importDir
  *
  * @param array                 $currentNode
  * @param integer               $depth
  * @param mixed                 $file
  * @param DocumentNodeInterface $targetNode
  *
  * @return DocumentNode
  */
 public function importDir($currentNode, $depth, $file, $targetNode)
 {
     $node = new DocumentNode();
     $node->setParent($currentNode[$depth])->setName($file->getBaseName())->setDepth($targetNode->getDepth() + $depth + 1);
     if (isset($this->options['node_callback']) && is_callable($this->options['node_callback'])) {
         call_user_func_array($this->options['node_callback'], array($node));
     }
     $this->emn->persist($node);
     return $node;
 }
Example #2
0
 /**
  * {@inheritDoc}
  */
 public function getPath()
 {
     $path = $this->node->getPath();
     $path->add($this->node);
     return $path;
 }
 /**
  * getNodeMetadatas
  *
  * @param DocumentNodeInterface $node
  */
 public function getNodeMetadatas(DocumentNodeInterface $node)
 {
     $metadatas = $this->registry->getRepository('Erichard\\DmsBundle\\Entity\\DocumentMetadata')->findByScope(array('node', 'both'));
     foreach ($metadatas as $meta) {
         if (!$node->hasMetadata($meta->getName())) {
             $metadata = new DocumentNodeMetadataLnk($meta);
             $node->addMetadata($metadata);
         }
     }
 }