Beispiel #1
0
 /**
  * Add dimension to function definition
  * @param Dimension $dimension
  * @param $i
  * @param $params
  * @param $declare
  * @param $fields
  * @param $setVars
  * @param bool|true $key
  */
 protected function addDimension(Dimension $dimension, &$i, &$params, &$declare, &$fields, &$setVars, $key = true)
 {
     $i++;
     $params[] = $dimension->getType()->getTableName();
     if ($key) {
         $declare[] = "DECLARE {$dimension->getTableName()}_id_var integer; ";
         $fields["{$dimension->getTableName()}_id"] = "{$dimension->getTableName()}_id_var";
         $parentParams = [];
         for ($j = 0; $j < $dimension->getSetterParamsCount(); $j++) {
             $parentParams[] = '$' . ($j + $i);
         }
         $parentParams = implode(', ', $parentParams);
         $setVars[] = "SELECT * INTO {$dimension->getTableName()}_id_var FROM get_{$dimension->getTableName()}_id({$parentParams}); ";
     }
     if ($parent = $dimension->getParent()) {
         $this->addDimension($parent, $i, $params, $declare, $fields, $setVars, false);
     }
 }