Skip to content

Commit

Permalink
Merge pull request InfyOmLabs#381 from claudiobastos/patch-1
Browse files Browse the repository at this point in the history
Prevent generator crash with "Undefined index"
  • Loading branch information
mitulgolakiya authored Mar 4, 2017
2 parents 3234478 + 56decf9 commit f4b3cd5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Utils/TableFieldsGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,10 @@ private function detectManyToOne($tables, $modelTable)
$foreignTable = $foreignKey->foreignTable;
$foreignField = $foreignKey->foreignField;

if (!isset($tables[$foreignTable])) {
continue;
}

if ($foreignField == $tables[$foreignTable]->primaryKey) {
$modelName = model_name_from_table_name($foreignTable);
$manyToOneRelations[] = GeneratorFieldRelation::parseRelation('mt1,'.$modelName);
Expand Down

0 comments on commit f4b3cd5

Please sign in to comment.