public function billingCategory($client) { $allProject = $client->api('project')->all(); foreach ($allProject['projects'] as $key => $project) { $issueList = $client->api('issue')->all(array('project_id' => $project['id'])); foreach ($issueList['issues'] as $key => $value) { $timeEntries = $client->api('time_entry')->all(array('issue_id' => $value['id'])); try { $billingCategory = new BillingCategory(); foreach ($timeEntries['time_entries'] as $key => $entry) { foreach ($entry['custom_fields'] as $key => $value) { $billingCategory->exchangeArray($value); $this->getBillingCategoryTable()->saveBillingCategory($billingCategory); } } } catch (\Exception $ex) { //send mail if any error occur during CRON JOB } } } }
public function billingCategory() { $issueId = 50620; $client = new Client("https://portal.optimusinfo.com/redmine/", 'vikas.singhal', 'vzi950'); $timeEntries = $client->api('time_entry')->all(array('issue_id' => $issueId)); //echo "<pre>";print_r($timeEntries);die; $billingCategory = new BillingCategory(); foreach ($timeEntries['time_entries'] as $key => $entry) { foreach ($entry['custom_fields'] as $key => $value) { $billingCategory->exchangeArray($value); $this->getBillingCategoryTable()->saveBillingCategory($billingCategory); } } return true; }