diff options
Diffstat (limited to 'lib/sfIsisImporter.class.php')
-rw-r--r-- | lib/sfIsisImporter.class.php | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/sfIsisImporter.class.php b/lib/sfIsisImporter.class.php index 6755477..4fd6353 100644 --- a/lib/sfIsisImporter.class.php +++ b/lib/sfIsisImporter.class.php @@ -123,24 +123,32 @@ class sfIsisImporter extends IsisConnector } /** - * Create a new model just if doesn't exist for a given entry. + * Create a new model just if doesn't exist for a given entry. For that + * to work the entry must provide and id. * * @param string $base_model Model to use * @param int $entry Entry number - * @return mixed New model with assigned id or false + * @return mixed New model or false */ public function newModel($base_model, $entry) { $model = new $base_model(); $id = $this->getBaseModelId($model); - if ($id && !call_user_func(array($base_model, 'getById'), $id)) + if ($id) { - $this->setBaseModelId($model); - return $model; + if (!call_user_func(array($base_model, 'getById'), $id)) + { + $this->setBaseModelId($model); + return $model; + } + else + { + return false; + } } - return false; + return $model; } /** |