-
Notifications
You must be signed in to change notification settings - Fork 622
Closed
Labels
Description
Hey guys,
I just wanted to generate models for all my tables, but it was horrifyingly slow.
Then when I checked the code, I found it was retrieving the relations of all tables anew for every tables it was generating.
Instead of generating references once, which would cause one request per table, (e.g. 200), I was now sitting through 40000. Adding this small and ugly fix however, I saw the generator suddenly fly through them.
I'm under no illusions that this is a decent piece of code to add, but I wanted to at least float the suggestion for now (maybe a pull request comes later), and ask if there is anything wrong with the basic assumption?
Phalcon\Builder\Model::build:241
if (isset(self::$rememberedReferences[$schema.$tableName])) {
$references = self::$rememberedReferences[$schema.$tableName];
} else {
$references = $db->describeReferences($tableName, $schema);
self::$rememberedReferences[$schema.$tableName] = $references;
}
foreach ($references as $reference) {