Example #1
0
	
	$aSiPrefixes[] = $prefix;
	PartKeepr::getEM()->persist($prefix);
	
}

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

/* Add units */
$data = \Symfony\Component\Yaml\Yaml::load("../setup/data/units.yaml");

$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);		
				}
			}
		}
	}
	
Example #2
0
	private function setUnitData (Unit $unit) {
		$unit->setName($this->getParameter("name"));
		$unit->setSymbol($this->getParameter("symbol"));
	}