Esempio n. 1
0
$aUnits = array();

foreach ($data as $unitName => $data) {
	$unit = new Unit();
	$unit->setName($unitName);
	$unit->setSymbol($data["symbol"]);
	
	if (array_key_exists("prefixes", $data)) {
		if (!is_array($data["prefixes"])) {
			echo "Obacht ".$unitName." ist falsch\n";
		}
		foreach ($data["prefixes"] as $prefix) {
			foreach ($aSiPrefixes as $siPrefix) {
				if ($siPrefix->getSymbol() == $prefix) {
					$unit->getPrefixes()->add($siPrefix);		
				}
			}
		}
	}
	
	PartKeepr::getEM()->persist($unit);
	$aUnits[] = $unit;
	
}

PartKeepr::getEM()->flush();


/* Add manufacturers and IC logos */
$data = \Symfony\Component\Yaml\Yaml::load("../setup/data/manufacturers/manufacturers.yaml");