Ejemplo n.º 1
0
 /**
  * @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;
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 public static function getMaterials()
 {
     $materials = DAOFactory::getMaterialDAO()->queryAll();
     return $materials;
 }
Ejemplo n.º 4
0
 /**
  * pull back the materials based on a given printer
  * @param unknown $printerId
  */
 public static function getMaterials($printerId)
 {
     $materials = DAOFactory::getMaterialDAO()->queryMaterialsByPrinterId($printerId);
     return $materials;
 }