/** * Computes the state of the delivery and returns one of the extended state code * * @param DeliveryExecution $deliveryExecution * @return null|string * @throws \common_Exception */ public function getState(DeliveryExecution $deliveryExecution) { return $deliveryExecution->getState()->getUri(); }
/** * Update the collection of deliveries * * @param DeliveryExecution $deliveryExecution * @param string $old * @param string $new */ public function updateDeliveryExecutionStatus(DeliveryExecution $deliveryExecution, $old, $new) { $userId = $deliveryExecution->getUserIdentifier(); if ($old != null) { $oldReferences = $this->getDeliveryExecutionsByStatus($userId, $old); foreach (array_keys($oldReferences) as $key) { if ($oldReferences[$key]->getIdentifier() == $deliveryExecution->getIdentifier()) { unset($oldReferences[$key]); } } $this->setDeliveryExecutions($userId, $old, $oldReferences); } $newReferences = $this->getDeliveryExecutionsByStatus($userId, $new); $newReferences[] = $deliveryExecution; $this->setDeliveryExecutions($userId, $new, $newReferences); }
/** * @param DeliveryExecution $deliveryExecution * @param boolean $updateData whether DeliveryMonitoringData instance should be populated by data during instantiation. * @return DeliveryMonitoringDataInterface */ public function getData(DeliveryExecution $deliveryExecution, $updateData = true) { $id = $deliveryExecution->getIdentifier(); if (!isset($this->data[$id])) { $this->data[$id] = new DeliveryMonitoringData($deliveryExecution, false); } else { $this->data[$id]->setDeliveryExecution($deliveryExecution); } if ($updateData) { $this->data[$id]->updateData(); } return $this->data[$id]; }