From bd99e1c991356c14b174c960229ef45e4eeaabe2 Mon Sep 17 00:00:00 2001 From: Silvio Date: Wed, 28 Jul 2010 15:20:47 -0300 Subject: Fixing primary key setup --- lib/sfIsisImporter.class.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'lib/sfIsisImporter.class.php') 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); + } } /** -- cgit v1.2.3