在阅读了一些源代码后,我自己找到了答案:
如果您想完成此操作,您需要修改文件:MysqlSchemaParser.php,位于:propel1/generator/lib/reverse/mysql(与 composer 一起安装时)
将第 99 行的记录集更改为:
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$name = $row[0];
$type = $row[1];
if ($name == $this->getMigrationTable() || $type != "BASE TABLE") {
continue;
}
/*
Edit : Find out if table isCrossRef
*/
$commentStmt = $this->dbh->query("show table status like '".$name."'");
$commentRow = $commentStmt->fetch(PDO::FETCH_OBJ);
$isCrossRef = (strtolower($commentRow->Comment) == 'iscrossref');
/*
End of edit
*/
if ($task) {
$task->log(" Adding table '" . $name . "'", Project::MSG_VERBOSE);
}
$table = new Table($name);
$table->setIdMethod($database->getDefaultIdMethod());
$table->setIsCrossRef($isCrossRef); /*EDIT : set is crossref to true*/
$database->addTable($table);
$tables[] = $table;
}