commit 37c75f453bc8b10defaa13792ca2e1f763784a82 parent 3cf676cb6862409262d2d102a560c2608cc8315c Author: Timo A. Hummel <timo@netraver.de> Date: Tue, 7 Jun 2011 11:25:43 +0200 If a new footprint is passed, it is always a string. Diffstat:
M | src/de/RaumZeitLabor/PartDB2/Footprint/FootprintManager.php | | | 18 | ++++++++++-------- |
M | src/de/RaumZeitLabor/PartDB2/StorageLocation/StorageLocationManager.php | | | 18 | ++++++++++-------- |
2 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/src/de/RaumZeitLabor/PartDB2/Footprint/FootprintManager.php b/src/de/RaumZeitLabor/PartDB2/Footprint/FootprintManager.php @@ -89,16 +89,18 @@ class FootprintManager extends Singleton { } public function getOrCreateFootprint ($footprint) { - try { - return $this->getFootprint($footprint); - } catch (FootprintNotFoundException $e) { - $fp = new Footprint(); - $fp->setFootprint($footprint); + if (is_int($footprint)) { + try { + return $this->getFootprint($footprint); + } catch (FootprintNotFoundException $e) {} + } + + $fp = new Footprint(); + $fp->setFootprint($footprint); - PartDB2::getEM()->persist($fp); + PartDB2::getEM()->persist($fp); - return $fp; - } + return $fp; } public function getFootprint ($id) { diff --git a/src/de/RaumZeitLabor/PartDB2/StorageLocation/StorageLocationManager.php b/src/de/RaumZeitLabor/PartDB2/StorageLocation/StorageLocationManager.php @@ -72,15 +72,17 @@ class StorageLocationManager extends Singleton { } public function getOrCreateStorageLocation ($storageLocation) { - try { - return $this->getStorageLocation($storageLocation); - } catch (StorageLocationNotFoundException $e) { - $sl = new StorageLocation(); - $sl->setName($storageLocation); + if (is_int($storageLocation)) { + try { + return $this->getStorageLocation($storageLocation); + } catch (StorageLocationNotFoundException $e) {} + } + + $sl = new StorageLocation(); + $sl->setName($storageLocation); - PartDB2::getEM()->persist($sl); + PartDB2::getEM()->persist($sl); - return $sl; - } + return $sl; } } \ No newline at end of file