diff options
author | Silvio <s1lv10@uol.com.br> | 2010-07-28 15:20:47 -0300 |
---|---|---|
committer | Silvio <s1lv10@uol.com.br> | 2010-07-28 15:20:47 -0300 |
commit | bd99e1c991356c14b174c960229ef45e4eeaabe2 (patch) | |
tree | 9b93207ad3f5ac9c7e8813c4265cdd24a5a8fe24 | |
parent | cd8010e938a2d82cc838bf0e1af8a2ab4e21aedb (diff) | |
download | sf_isis_importer_plugin-bd99e1c991356c14b174c960229ef45e4eeaabe2.tar.gz sf_isis_importer_plugin-bd99e1c991356c14b174c960229ef45e4eeaabe2.tar.bz2 |
Fixing primary key setup
-rw-r--r-- | lib/sfIsisImporter.class.php | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/sfIsisImporter.class.php b/lib/sfIsisImporter.class.php index 9233f64..d3866bf 100644 --- a/lib/sfIsisImporter.class.php +++ b/lib/sfIsisImporter.class.php @@ -72,22 +72,14 @@ class sfIsisImporter extends sfIsisImporterBase } /** - * Set the primary key for the model by getting it or saving the model. + * Set the primary key for the model by getting it or just saving it. * * @param object $model Base model */ public function setBaseModelId(&$model) { - $id = $this->getBaseModelId($model); - - if ($id) - { - $model->id = $id; - } - else - { - $model->save(); - } + $model->id = $this->getBaseModelId($model); + $model->save(); } /** @@ -95,11 +87,14 @@ class sfIsisImporter extends sfIsisImporterBase * * @param object $model Base model * @return int Base model id - * @todo Write and test */ public function getBaseModelId(&$model) { - return false; + $method = get . $this->getModelName($model) .'PrimaryKey'; + if (method_exists($this, $method)) + { + return $this->{$method}($model); + } } /** |