/**
  * Create a fresh collection instance and clone dimensions
  *
  * @return void
  */
 public function __clone()
 {
     if ($this->dimensions instanceof Collection) {
         $existingDimensions = $this->dimensions->toArray();
         $this->dimensions = new ArrayCollection();
         /** @var NodeDimension $existingDimension */
         foreach ($existingDimensions as $existingDimension) {
             $this->dimensions->add(new NodeDimension($this, $existingDimension->getName(), $existingDimension->getValue()));
         }
     }
 }
Exemple #2
0
 /**
  * Constructs this node data container
  *
  * Creating new nodes by instantiating NodeData is not part of the public API!
  * The content repository needs to properly integrate new nodes into the node
  * tree and therefore you must use createNode() or createNodeFromTemplate()
  * in a Node object which will internally create a NodeData object.
  *
  * @param string $path Absolute path of this node
  * @param \TYPO3\TYPO3CR\Domain\Model\Workspace $workspace The workspace this node will be contained in
  * @param string $identifier The node identifier (not the persistence object identifier!). Specifying this only makes sense while creating corresponding nodes
  * @param array $dimensions An array of dimension name to dimension values
  */
 public function __construct($path, Workspace $workspace, $identifier = NULL, array $dimensions = NULL)
 {
     $this->setPath($path, FALSE);
     $this->workspace = $workspace;
     $this->identifier = $identifier === NULL ? Algorithms::generateUUID() : $identifier;
     $this->dimensions = new \Doctrine\Common\Collections\ArrayCollection();
     if ($dimensions !== NULL) {
         foreach ($dimensions as $dimensionName => $dimensionValues) {
             foreach ($dimensionValues as $dimensionValue) {
                 $this->dimensions->add(new NodeDimension($this, $dimensionName, $dimensionValue));
             }
         }
     }
     $this->calculateDimensionsHash();
     $this->buildDimensionValues();
 }