f3 = $f3; parent::__construct($f3->get('DB'), 'queuesystem'); $this->serviceName = $serviceName; } /** * Send object to <$serviceName>. * send() serialize $obj before send to queue * * @param $obj */ public function send($obj) { $serializedObject = serialize($obj); $this->reset(); $this->servicename = $this->serviceName; $this->command = base64_encode($serializedObject); $this->save(); } /** * Retrieve and unserialize current object * * @return mixed */ public function getCommandObject() { $decodedObj = base64_decode($this->command); $obj = unserialize($decodedObj); return $obj; } /** * Retrieve messages * * @return array|FALSE */ public function check() { if (!$this->initLoad) { $this->initLoad = true; $this->load(['servicename=?', $this->serviceName]); } return $this->dry(); } /** * Delete all messages of <$serviceName> */ public function deleteAll() { $this->reset(); $this->erase(['servicename=?', $this->serviceName]); } }