Closed zhang988925 closed 6 years ago
public static String getTableByActiveRecordClass(PhpClass phpClass) { Method method = phpClass.findMethodByName("tableName"); if (method != null) { "……" } String className = phpClass.getName(); // Change here return AddTablePrefix(StringUtils.CamelToId(className), true, phpClass.getProject()); }
com/nvlad/yii2support/common/DatabaseUtils.java In the 268 line
public static ArrayList<String> getColumnsByTable(String table, Project project) { // This My be a BUG can cause duplicate String prefixedTable = AddTablePrefix(table, true, project); DbPsiFacade facade = DbPsiFacade.getInstance(project); List<DbDataSource> dataSources = facade.getDataSources(); ArrayList<String> list = new ArrayList<>(); if(table == null) return list; table = ClassUtils.removeQuotes(prefixedTable); for (DbDataSource source : dataSources) { for (Object item : source.getModel().traverser().children(source.getModel().getCurrentRootNamespace())) { if (item instanceof DbTable && ((DbTable) item).getName().equals(prefixedTable)) { TableInfo tableInfo = new TableInfo((DbTable) item); for (DasColumn column : tableInfo.getColumns()) { list.add(ClassUtils.removeQuotes(column.getName())); } } } } return list; }
com/nvlad/yii2support/common/DatabaseUtils.java In the 268 line