Skip to content

Commit e847050

Browse files
committed
Structure: added rebuild when table not exists in cache -[fixed #79]
1 parent 09459e0 commit e847050

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Database/Structure.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ public function rebuild()
137137
{
138138
$this->structure = $this->loadStructure();
139139
$this->cache->save('structure', $this->structure);
140-
$this->isRebuilt = TRUE;
141140
}
142141

143142

@@ -192,6 +191,8 @@ public function loadStructure()
192191
}
193192
}
194193

194+
$this->isRebuilt = TRUE;
195+
195196
return $structure;
196197
}
197198

@@ -241,6 +242,11 @@ protected function resolveFQTableName($table)
241242
return $this->structure['aliases'][$name];
242243
}
243244

245+
if (!$this->isRebuilt()) {
246+
$this->rebuild();
247+
return $this->resolveFQTableName($table);
248+
}
249+
244250
throw new Nette\InvalidArgumentException("Table '$name' does not exist.");
245251
}
246252

0 commit comments

Comments
 (0)