diff options
author | Silvio <s1lv10@uol.com.br> | 2010-07-30 15:30:55 -0300 |
---|---|---|
committer | Silvio <s1lv10@uol.com.br> | 2010-07-30 15:30:55 -0300 |
commit | 662d10abaa494324841a00fe09d494718684e03e (patch) | |
tree | dc18ad528c56c080ed332739ff834f2ca41063b5 /lib/sfIsisImporter.class.php | |
parent | 3f44e99278fbbb64020ec3718a98f853b68e884c (diff) | |
download | sf_isis_importer_plugin-662d10abaa494324841a00fe09d494718684e03e.tar.gz sf_isis_importer_plugin-662d10abaa494324841a00fe09d494718684e03e.tar.bz2 |
Fixing newModel behavior
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; } /** |