protected function runDaily($jobConfig) { $params = Utils::replaceDates($jobConfig["parameters"], "%%", "Y-m-d"); $params = Utils::json_decode($params, true); $from = !empty($params["from"]) ? $params["from"] : Utils::formatDateTime("1 week ago", "Y-m-d"); $to = !empty($params["until"]) ? $params["until"] : Utils::formatDateTime("today", "Y-m-d"); $end = new \DateTime($to); $end->modify('+1 day'); $period = new \DatePeriod(new \DateTime($from), new \DateInterval('P1D'), $end); foreach ($period as $day) { // var_dump($day); $job = $this->initJob(array("endpoint" => "/v2/analytics/reports/account/performance/videos/" . $day->format("Y-m-d"), "parameters" => '{"limit":"500", "order_by":"none"}', "alias" => 'videos_daily')); // use ParentId for day $job->setParent($day->format("Y-m-d")); $job->run(); } }
public function init() { $this->configName = empty($this->config["alias"]) ? preg_replace("/[^A-Za-z0-9\\-\\._]/", "_", trim($this->config["endpoint"], "/")) : $this->config["alias"]; $this->config["endpoint"] = Utils::replaceDates($this->config["endpoint"], "%%", "Y-m-d"); }