/** * @param unknown $data */ function addSupplier($data) { // check to see if the "supplier exists" // if not then add it. // if so then we get it's id. $supplier = new Supplier(); $existing = DAOFactory::getSupplierDAO()->queryByCompanyName($data[self::MANUFACTURER]); if ($existing == NULL) { $supplier->type = 'MATERIAL'; $supplier->companyName = $data[self::MANUFACTURER]; $supplier->homepage = $data[self::USEFUL_LINKS]; $supplier->supplierId = DAOFactory::getSupplierDAO()->insert($supplier); } else { // need to update if (is_array($existing)) { $supplier = $existing[0]; } } return $supplier; }
public static function getSuppliersByType($lookup) { $suppliers = DAOFactory::getSupplierDAO()->queryByType($lookup); return $suppliers; }