Neos\ContentRepository\Domain\Model\AbstractNodeData::__construct PHP Method

__construct() public method

Constructs this node data container
public __construct ( )
    public function __construct()
    {
        $this->creationDateTime = new \DateTime();
        $this->lastModificationDateTime = new \DateTime();
    }

Usage Example

Exemplo n.º 1
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 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)
 {
     parent::__construct();
     $this->creationDateTime = new \DateTime();
     $this->lastModificationDateTime = new \DateTime();
     $this->setPath($path, false);
     $this->workspace = $workspace;
     $this->identifier = $identifier === null ? Algorithms::generateUUID() : $identifier;
     $this->dimensions = new ArrayCollection();
     if ($dimensions !== null) {
         foreach ($dimensions as $dimensionName => $dimensionValues) {
             foreach ($dimensionValues as $dimensionValue) {
                 $this->dimensions->add(new NodeDimension($this, $dimensionName, $dimensionValue));
             }
         }
     }
     $this->buildDimensionValues();
 }