/**
  * Internal use, do not manipulate collection directly
  *
  * @param array<NodeDimension> $dimensionsToBeSet
  * @return void
  */
 public function setDimensions(array $dimensionsToBeSet)
 {
     if ($this->dimensions->count() > 0) {
         $givenDimensions = $dimensionsToBeSet;
         $dimensionsToBeSet = array();
         /** @var NodeDimension $dimensionToBeSet */
         foreach ($givenDimensions as $dimensionToBeSet) {
             $dimensionExisted = false;
             /** @var NodeDimension $dimension */
             foreach ($this->dimensions as $dimension) {
                 if ($dimension->getName() === $dimensionToBeSet->getName() && $dimensionToBeSet->getValue() === $dimension->getValue()) {
                     $dimensionsToBeSet[] = $dimension;
                     $dimensionExisted = true;
                 }
             }
             if (!$dimensionExisted) {
                 $dimensionToBeSet->setNodeData($this);
                 $dimensionsToBeSet[] = $dimensionToBeSet;
             }
         }
     }
     $this->dimensions = new ArrayCollection($dimensionsToBeSet);
     $this->buildDimensionValues();
 }
 /**
  * Internal use, do not manipulate collection directly
  *
  * @param array <NodeDimension> $dimensionsToBeSet
  * @return void
  */
 public function setDimensions(array $dimensionsToBeSet)
 {
     if ($this->dimensions->count() === 0) {
         $this->dimensions = new ArrayCollection($dimensionsToBeSet);
         $this->buildDimensionValues();
         return;
     }
     $expectedDimensions = [];
     /** @var NodeDimension $dimensionToBeSet */
     foreach ($dimensionsToBeSet as $dimensionToBeSet) {
         $dimensionToBeSet->setNodeData($this);
         $existingDimension = $this->findExistingDimensionMatching($dimensionToBeSet);
         $expectedDimensions[] = $existingDimension !== null ? $existingDimension : $dimensionToBeSet;
         if ($existingDimension === null) {
             $this->dimensions->add($dimensionToBeSet);
         }
     }
     // remove entries not to be set
     $dimensionsToRemove = $this->dimensions->filter(function (NodeDimension $dimension) use($expectedDimensions) {
         return array_search($dimension, $expectedDimensions) === false;
     });
     foreach ($dimensionsToRemove as $dimension) {
         $this->dimensions->removeElement($dimension);
     }
     $this->buildDimensionValues();
 }