private static function getMailingJobs($params) { if (is_array(static::$jobs)) { return static::$jobs; } static::$jobs = array(); if (empty($params['crm_mailing_id'])) { return static::$jobs; } $jobBao = new CRM_Mailing_BAO_MailingJob(); // This needs to be done as there can only be one query per DAO (see docs for reset()) - without this, the DAO // object was keeping residual data from previous operations elsewhere on the same DAO, making the below operations // unpredictable and fail $jobBao->reset(); // This is needed as the reset() above clears the query completely $jobBao->selectAdd('*'); $jobBao->mailing_id = $params['crm_mailing_id']; $jobBao->is_test = 0; if ($jobBao->find()) { while ($jobBao->fetch()) { static::$jobs[] = $jobBao->toArray(); } } $jobBao->free(); return static::$jobs; }