src/wcmf/lib/model/ObjectQuery.php
protected function processTableName(Node $tpl) {
    $mapper = self::getMapper($tpl->getType());
    $mapperTableName = $mapper->getRealTableName();

    $tableName = $tpl->getProperty(self::PROPERTY_TABLE_NAME);
    if ($tableName == null) {
      $tableName = $mapperTableName;

      // if the template is the child of another node of the same type,
      // we must use a table alias
      $parents = $tpl->getParentsEx(null, null, $tpl->getType());
      foreach ($parents as $curParent) {
        $curParentTableName = $curParent->getProperty(self::PROPERTY_TABLE_NAME);
        if ($curParentTableName == $tableName) {
          $tableName .= '_'.($this->aliasCounter++);
        }
      }
      // set the table name for later reference
      $tpl->setProperty(self::PROPERTY_TABLE_NAME, $tableName);
    }

    return ['name' => $mapperTableName, 'alias' => $tableName];
  }
protected function processTableName(Node $tpl) {
    $mapper = self::getMapper($tpl->getType());
    $mapperTableName = $mapper->getRealTableName();

    $tableName = $tpl->getProperty(self::PROPERTY_TABLE_NAME);
    if ($tableName == null) {
      $tableName = $mapperTableName;

      // if the template is the child of another node of the same type,
      // we must use a table alias
      $parents = $tpl->getParentsEx(null, null, $tpl->getType());
      foreach ($parents as $curParent) {
        $curParentTableName = $curParent->getProperty(self::PROPERTY_TABLE_NAME);
        if ($curParentTableName == $tableName) {
          $tableName .= '_'.($this->aliasCounter++);
        }
      }
      // set the table name for later reference
      $tpl->setProperty(self::PROPERTY_TABLE_NAME, $tableName);
    }

    return ['name' => $mapperTableName, 'alias' => $tableName];
  }
protected function processTableName ( Node $ tpl ) { $ mapper = self :: getMapper ( $ tpl -> getType ( ) ) ; $ mapperTableName = $ mapper -> getRealTableName ( ) ; $ tableName = $ tpl -> getProperty ( self :: PROPERTY_TABLE_NAME ) ; if ( $ tableName == null ) { $ tableName = $ mapperTableName ; // if the template is the child of another node of the same type, // we must use a table alias $ parents = $ tpl -> getParentsEx ( null , null , $ tpl -> getType ( ) ) ; foreach ( $ parents as $ curParent ) { $ curParentTableName = $ curParent -> getProperty ( self :: PROPERTY_TABLE_NAME ) ; if ( $ curParentTableName == $ tableName ) { $ tableName .= '_' . ( $ this -> aliasCounter ++ ) ; } } // set the table name for later reference $ tpl -> setProperty ( self :: PROPERTY_TABLE_NAME , $ tableName ) ; } return [ 'name' => $ mapperTableName , 'alias' => $ tableName ] ; }
Get the table name for the template and calculate an alias if
necessary.
@param $tpl The object template
@return Associative array with keys 'name', 'alias'
Get the table name for the template and calculate an alias if necessary .