commit f1bb3bf8dce284a08dd4061deea23e80d3e49cfb
parent babe601e4bd4da5d489ae374bb849299a1cf63d5
Author: Felicitus <felicitus@felicitus.org>
Date: Thu, 23 Jun 2011 12:46:28 +0200
Fixed bug where no part/manufacturer/distributor is linked
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/testing/SetupDatabase.php b/testing/SetupDatabase.php
@@ -361,10 +361,16 @@ while ($part = mysql_fetch_assoc($r)) {
$oPart->setPartUnit($partUnit);
for ($i=0;$i<rand(0,15);$i++) {
$randomManufacturer = rand(0, count($aManufacturers)-1);
- $oPart->getManufacturers()->add(new PartManufacturer($oPart, $aManufacturers[$randomManufacturer]));
+ $partManufacturer = new PartManufacturer();
+ $partManufacturer->setPart($oPart);
+ $partManufacturer->setManufacturer($aManufacturers[$randomManufacturer]);
+ $oPart->getManufacturers()->add($partManufacturer);
}
- $oPart->getDistributors()->add(new PartDistributor($oPart, $aDistributors[$part["id_supplier"]]));
+ $partDistributor = new PartDistributor();
+ $partDistributor->setPart($oPart);
+ $partDistributor->setDistributor($aDistributors[$part["id_supplier"]]);
+ $oPart->getDistributors()->add($partDistributor);
//echo "Migrating part ".sprintf("%-40s", $part["name"])."\r";