コード例 #1
0
ファイル: Warehouses.php プロジェクト: jim5359/shipwire
 /**
  * Query all the rows
  * @return Warehouse[]
  */
 public function loadAll()
 {
     $sql = "\n            SELECT\n                warehouse_id id, name, street_address streetAddress, city, state, postal_code postalCode, longitude, latitude\n            FROM\n                warehouses\n        ";
     $statement = Database::getInstance()->prepare($sql);
     $statement->execute();
     $warehouses = $this->convertToObjects($statement->fetchAll(\PDO::FETCH_ASSOC));
     foreach ($warehouses as &$warehouse) {
         $warehouse->setProducts(Products::getInstance()->loadForWarehouse($warehouse->getId()));
     }
     return $warehouses;
 }
コード例 #2
0
ファイル: AddOrderProduct.php プロジェクト: jim5359/shipwire
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->_orders = Orders::getInstance()->loadAll();
     $this->_products = Products::getInstance()->loadAll();
     $orderSelections = '';
     $this->_validResponses['orderNum'] = array();
     foreach ($this->_orders as $index => $order) {
         $selectNum = $index + 1;
         $this->_validResponses['orderNum'][] = $selectNum;
         $orderSelections .= "\t{$selectNum}) " . $order->getFullAddress() . "\n";
     }
     $orderSelections .= 'Please enter your choice: ';
     $productSelections = '';
     $this->_validResponses['productNum'] = array();
     foreach ($this->_products as $index => $product) {
         $selectNum = $index + 1;
         $this->_validResponses['productNum'][] = $selectNum;
         $productSelections .= "\t{$selectNum}) " . $product->getName() . "\n";
     }
     $productSelections .= 'Please enter your choice: ';
     $this->_prompts = array('orderNum' => "Please select an order:\n" . $orderSelections, 'productNum' => "Please select a product:\n" . $productSelections);
 }
コード例 #3
0
ファイル: AddProductStock.php プロジェクト: jim5359/shipwire
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->_products = Products::getInstance()->loadAll();
     $this->_warehouses = Warehouses::getInstance()->loadAll();
     $warehouseSelections = '';
     $this->_validResponses['warehouseNum'] = array();
     foreach ($this->_warehouses as $index => $warehouse) {
         $selectNum = $index + 1;
         $this->_validResponses['warehouseNum'][] = $selectNum;
         $warehouseSelections .= "\t{$selectNum}) " . $warehouse->getName() . "\n";
     }
     $warehouseSelections .= 'Please enter your choice: ';
     $productSelections = '';
     $this->_validResponses['productNum'] = array();
     foreach ($this->_products as $index => $product) {
         $selectNum = $index + 1;
         $this->_validResponses['productNum'][] = $selectNum;
         $productSelections .= "\t{$selectNum}) " . $product->getName() . "\n";
     }
     $productSelections .= 'Please enter your choice: ';
     $this->_prompts = array('warehouseNum' => "Please select a warehouse:\n" . $warehouseSelections, 'productNum' => "Please select a product:\n" . $productSelections);
 }
コード例 #4
0
ファイル: AddProduct.php プロジェクト: jim5359/shipwire
 /**
  * @param array $results
  */
 protected function finish($results)
 {
     $product = new Product($results);
     Products::getInstance()->save($product);
     echo "Product added successfully.\n";
 }