Skip to content

Commit

Permalink
refactor(Model): init schema if option exists and is not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
dacgray committed May 21, 2019
1 parent 2693c64 commit 50bb25e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions scripts/Phalcon/Builder/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,14 @@ public function build()

$initialize = [];

if ($this->modelOptions->hasOption('schema')) {
// use option schema if exists and is not empty
if ($this->modelOptions->hasOption('schema') && !empty($this->modelOptions->getOption('schema'))) {
$schema = $this->modelOptions->getOption('schema');
$initialize['schema'] = $snippet->getThisMethod('setSchema', $schema);
} else {
$schema = Utils::resolveDbSchema($config->database);
}

if (!empty($this->modelOptions->getOption('schema'))) {
$initialize['schema'] = $snippet->getThisMethod('setSchema', $schema);
}
$initialize['source'] = $snippet->getThisMethod('setSource', $this->modelOptions->getOption('name'));

$table = $this->modelOptions->getOption('name');
Expand Down

0 comments on commit 50bb25e

Please sign in to comment.