public function allProjects() { $client = new Client("https://portal.optimusinfo.com/redmine/", 'vikas.singhal', 'vzi950'); $allProject = $client->api('project')->all(); //echo "<pre>";print_r($allProject);die; $projects = new Projects(); foreach ($allProject['projects'] as $key => $project) { $projects->exchangeArray($project); $this->getProjectsTable()->saveProjects($projects); } return true; }
public function allProjects($client) { $allProject = $client->api('project')->all(); try { $projects = new Projects(); foreach ($allProject['projects'] as $key => $project) { // set values into class level variable to insert or update into database $projects->exchangeArray($project); $projectInfo = $this->getProjectsTable()->saveProjects($projects); // GET all Issue detail related to Projects $this->allIssue($client, $project['id']); } } catch (\Exception $ex) { //send mail if any error occur during CRON JOB } }