Beispiel #1
0
 public function testGet_account()
 {
     $this->assertInstanceOf('Bridge_Account', $this->object->get_account());
     $this->assertEquals($this->account, $this->object->get_account());
     $this->assertEquals($this->account->get_id(), $this->object->get_account()->get_id());
 }
Beispiel #2
0
 /**
  * @param Bridge_Element $element
  *
  * @return BridgeJob
  */
 protected function update_element(Application $app, \Bridge_Element $element)
 {
     $account = $element->get_account();
     $connector_status = $account->get_api()->get_element_status($element);
     $status = $element->get_account()->get_api()->map_connector_to_element_status($connector_status);
     $error_message = $element->get_account()->get_api()->get_error_message_from_status($connector_status);
     $previous_status = $element->get_status();
     if ($status) {
         $element->set_status($status);
         $this->log('debug', 'updating status for : ' . $element->get_id() . " to " . $status);
     }
     $element->set_connector_status($connector_status);
     if ($status === $previous_status) {
         return;
     }
     switch ($status) {
         case \Bridge_Element::STATUS_ERROR:
             $app['dispatcher']->dispatch(new BridgeUploadFailureEvent($element, $error_message));
             break;
         default:
         case \Bridge_Element::STATUS_DONE:
         case \Bridge_Element::STATUS_PENDING:
         case \Bridge_Element::STATUS_PROCESSING_SERVER:
         case \Bridge_Element::STATUS_PROCESSING:
             break;
     }
     return $this;
 }
Beispiel #3
0
 /**
  * @param Bridge_Element $element
  *
  * @return BridgeJob
  */
 protected function update_element(Application $app, \Bridge_Element $element)
 {
     $account = $element->get_account();
     $connector_status = $account->get_api()->get_element_status($element);
     $status = $element->get_account()->get_api()->map_connector_to_element_status($connector_status);
     $error_message = $element->get_account()->get_api()->get_error_message_from_status($connector_status);
     $previous_status = $element->get_status();
     if ($status) {
         $element->set_status($status);
         $this->log('debug', 'updating status for : ' . $element->get_id() . " to " . $status);
     }
     $element->set_connector_status($connector_status);
     if ($status === $previous_status) {
         return;
     }
     switch ($status) {
         case \Bridge_Element::STATUS_ERROR:
             $params = ['usr_id' => $account->get_user()->getId(), 'reason' => $error_message, 'account_id' => $account->get_id(), 'sbas_id' => $element->get_record()->get_sbas_id(), 'record_id' => $element->get_record()->get_record_id()];
             $app['events-manager']->trigger('__BRIDGE_UPLOAD_FAIL__', $params);
             break;
         default:
         case \Bridge_Element::STATUS_DONE:
         case \Bridge_Element::STATUS_PENDING:
         case \Bridge_Element::STATUS_PROCESSING_SERVER:
         case \Bridge_Element::STATUS_PROCESSING:
             break;
     }
     return $this;
 }