/** * @param unknown $data */ function addMaterial($data) { // check to see if the material type exists // if not then add it. // if so then update it. $material = new Material(); $existing = DAOFactory::getMaterialDAO()->queryByType($data[self::FILAMENT_TYPE]); echo ' material ' . $material->type . ' id ' . $material->materialId . ' data : ' . $data[self::FILAMENT_TYPE]; if ($existing == NULL) { $material->type = $data[self::FILAMENT_TYPE]; $material->materialId = DAOFactory::getMaterialDAO()->insert($material); } else { $material = $existing; } return $material; }
public function queryByKeys($name, $type, $color, $diameter) { $material = DAOFactory::getMaterialDAO()->queryByType($type); $sql = 'select * from filament where name = ? and material_id = ? and color = ? and size = ?'; $sqlQuery = new SqlQuery($sql); $sqlQuery->set($name); $sqlQuery->setNumber($material->materialId); $sqlQuery->set($color); $sqlQuery->setNumber($diameter); return $this->getList($sqlQuery); }
public static function getMaterials() { $materials = DAOFactory::getMaterialDAO()->queryAll(); return $materials; }
/** * pull back the materials based on a given printer * @param unknown $printerId */ public static function getMaterials($printerId) { $materials = DAOFactory::getMaterialDAO()->queryMaterialsByPrinterId($printerId); return $materials; }