/** * ADD block to stack. * * @param EiTestSetBlockStack $parentStack * @return EiTestSetBlockStack */ public function addToStack(EiTestSetBlockStack $parentStack = null) { $dataSetStr = null; $position = 1; if ($parentStack != null) { $position = $parentStack->getPosition() + 1; $dataSetStr = $this->getTable()->getDataFromDataSet($this, $parentStack); } else { $dataSetStr = $this->getTable()->getDataFromDataSet($this); } $stack = new EiTestSetBlockStack(); $stack->setEiTestSet($this->getEiTestSet()); $stack->setEiVersionStructure($this->getEiVersionStructure()); $stack->setEiTestSetBlockParam($this); $stack->setEiTestSetDataSet($dataSetStr); $stack->setPath($this->getPath()); $stack->setPosition($position); $stack->save(); return $stack; }