/** * Create queue mailing by status only * * @param array $options * @throws \Deliveries\Exceptions\AppException * @throws \Exception * @return int $pid created process id */ public function createQueue(array $options) { // get status from options $status = array_search(true, $options, true); if (empty($status) === true) { throw new AppException('Submission create status not defined', 'info'); } // get lists by status argument $lists = $this->storageInstance->getLists($status); try { // push lists to queue processing & get process id $pid = $this->queueInstance->push($lists); // date create verification $this->verifyDate($options['date']); // save process id , adapter to storage $this->storageInstance->saveQueue($pid, [':storage' => $this->getClassName($this->storageInstance), ':broker' => $this->getClassName($this->queueInstance), ':mail' => $this->getClassName($this->mailInstance)], $options['date'], $options['priority']); } catch (\RuntimeException $e) { // remove queue from list $this->queueInstance->delete(); throw new \Exception($e->getMessage(), $e->getCode()); } return $pid; }