Example #1
0
 /**
  * Metodo para agregar un CustomsBroker a la base de datos
  * @param CustomsBroker $customsBroker Objeto CustomsBroker
  */
 public function create($customsBroker)
 {
     $this->validateBean($customsBroker);
     try {
         if (!$customsBroker->getIdCompany()) {
             parent::create($customsBroker);
         }
         $data = $customsBroker->toArrayFor(array('id_company', 'id_last_fee_file', 'payment', 'status'));
         $data = array_filter($data, array($this, 'isNotNull'));
         $this->getDb()->insert(CustomsBroker::TABLENAME, $data);
         $customsBroker->setIdCustomsBroker($this->getDb()->lastInsertId());
     } catch (\Exception $e) {
         $this->throwException("The CustomsBroker can't be saved \n", $e);
     }
 }
Example #2
0
 /**
  * Metodo para agregar un Supplier a la base de datos
  * @param Supplier $supplier Objeto Supplier
  */
 public function create($supplier)
 {
     $this->validateBean($supplier);
     try {
         if (!$supplier->getIdCompany()) {
             parent::create($supplier);
         }
         $data = $supplier->toArrayFor(array('id_invoice_address', 'id_company', 'id_currency', 'id_payment_term', 'id_default_port', 'card_name', 'rfc', 'type_person', 'paydays', 'id_final_grand_risk', 'id_approval_status', 'quality', 'consistency', 'time', 'type_supplier'));
         $data = array_filter($data, array($this, 'isNotNull'));
         $this->getDb()->insert(Supplier::TABLENAME, $data);
         $supplier->setIdSupplier($this->getDb()->lastInsertId());
     } catch (\Exception $e) {
         $this->throwException("The Supplier can't be saved \n", $e);
     }
 }