public function insert(C3op_Projects_Outlay $new) { $data = array('project' => $new->GetProject(), 'action' => $new->GetAction(), 'human_resource' => $new->GetHumanResource(), 'predicted_value' => $new->GetPredictedValue(), 'predicted_date' => $new->GetPredictedDate(), 'recurrent' => $new->GetRecurrent(), 'observation' => $new->GetObservation()); $this->db->insert('projects_outlays', $data); $new->SetId((int) $this->db->lastInsertId()); $this->identityMap[$new] = $new->GetId(); }
private function outlayAsAParcel(C3op_Projects_Outlay $outlay) { $humanResourceId = $outlay->GetHumanResource(); if (!isset($this->humanResourceMapper)) { $this->humanResourceMapper = new C3op_Projects_HumanResourceMapper($this->db); } $outlayHumanResource = $this->humanResourceMapper->findById($humanResourceId); $listOutlaysForHumanResource = $this->humanResourceMapper->getAllOutlays($outlayHumanResource); $totalParcels = count($listOutlaysForHumanResource); $parcelsCount = 0; foreach ($listOutlaysForHumanResource as $parcelId) { $thisParcel = $this->outlayMapper->FindById($parcelId); $parcelsCount++; if ($thisParcel->GetId() == $outlay->GetId()) { $myParcel = $parcelsCount; } } return "{$myParcel}/{$totalParcels}"; }