Ejemplo n.º 1
0
 public function updateStatus($status)
 {
     if (false === WsPackageStatus::checkStatus($status)) {
         throw new Exception("Wrong status specified!");
     }
     $this->getTable()->getDefaultAdapter()->beginTransaction();
     $createdBy = $this->created_by;
     $idPackage = $this->id_package;
     $this->getTable()->getDefaultAdapter()->query('LOCK TABLE ws.package_status IN ROW EXCLUSIVE MODE;')->fetch();
     try {
         $this->softDelete();
         $this->getTable()->createRow(array('created_by' => $createdBy, 'id_status' => $status, 'id_package' => $idPackage))->save();
         $this->getTable()->getDefaultAdapter()->commit();
     } catch (Exception $e) {
         $this->getTable()->getDefaultAdapter()->rollBack();
     }
 }
Ejemplo n.º 2
0
 public function showAction()
 {
     $request = $this->getRequest();
     $id = $this->_helper->IdConvert->hexToStr($request->getParam('id'));
     if (intval($id) <= 0) {
         $this->_helper->messenger()->error("Brak parametru ID");
         return $this->_helper->redirector('index', $request->getControllerName());
     }
     $package = $this->_model->getPackage($id);
     $this->_logicPackage->getPackageDataInfo($package);
     $this->view->data = $package;
     $packageStatusModel = new WsPackageStatus();
     $statusHistory = $packageStatusModel->getStatusHistory($id);
     $statusPaginator = new Base_Paginator(new Base_Paginator_Adapter_Array($statusHistory->toArray(), array('RowClass' => 'Row_WsPackageStatus')));
     $this->view->status_history = $statusPaginator;
     $this->view->statusHeaders = array('id_status', 'created_at', 'created_by', 'ghosted_at', 'ghosted_by');
     $this->view->packageID = $request->getParam('id');
 }
Ejemplo n.º 3
0
 /**
  * Dodanie job id handlera dla Gearman
  * @param integer $packageId
  * @param integer $idJobHandler
  */
 public function setPackageJobHandler($packageId, $idJobHandler)
 {
     $packageStatus = new WsPackageStatus();
     $packageStatusRow = $packageStatus->findOneByPackageId($packageId);
     if (null === $packageStatusRow) {
         throw new Exception("Cannot find package status for package with id={$packageId}");
     }
     $packageStatusRow->setFromArray(array('id_job_handle' => $idJobHandler))->save();
 }