Exemplo n.º 1
0
 public function getTables($scope = ENTITY_SCOPE_ALL)
 {
     if (!is_array($this->TABLES)) {
         $this->TABLES[ENTITY_SCOPE_ALL] = array();
         $this->TABLES[ENTITY_SCOPE_SDK] = array();
         $this->TABLES[ENTITY_SCOPE_PROJ] = array();
         $tables = PsTable::all();
         $tablesNotConfigured = array();
         //Таблицы, описанные в ini, но не сконфигурированные
         foreach (DbIni::getTables() as $tableName) {
             if (!array_key_exists($tableName, $tables)) {
                 continue;
                 //---
             }
             /* @var $table PsTable */
             $table = $tables[$tableName];
             if ($table->isConfigured()) {
                 $this->TABLES[ENTITY_SCOPE_ALL][$tableName] = $table;
                 $this->TABLES[$table->getScope()][$tableName] = $table;
                 unset($tables[$tableName]);
             } else {
                 $tablesNotConfigured[ENTITY_SCOPE_ALL][$tableName] = $table;
                 $tablesNotConfigured[$table->getScope()][$tableName] = $table;
             }
         }
         foreach ($tablesNotConfigured as $_scope => $_tables) {
             $this->TABLES[$_scope] = array_merge($this->TABLES[$_scope], $_tables);
         }
         foreach ($tables as $tableName => $table) {
             $this->TABLES[ENTITY_SCOPE_ALL][$tableName] = $table;
             $this->TABLES[$table->getScope()][$tableName] = $table;
         }
     }
     return $this->TABLES[PsCheck::scope($scope)];
 }