public static function initWithArray($array) { $instance = new self(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); $instance->setName($array[Event::EVENT_NAME]); $instance->setCode($array[Event::EVENT_CODE]); $instance->setCat_id($array[Event::EVENT_CAT_ID]); $instance->setShort_desc($array[Event::EVENT_SHORTDESC]); $instance->setLong_desc($array[Event::EVENT_LONGDESC]); $instance->setTags($array[Event::EVENT_TAGS]); $instance->setContacts($array[Event::EVENT_CONTACTS]); $instance->setPrize($array[Event::EVENT_PRIZE]); $instance->setPrtpnt($array[Event::EVENT_PRTPNT]); $instance->setValidate($array[Event::EVENT_VALIDATE]); $instance->setLocation_id($array[Event::EVENT_LOCATIONID]); $instance->setTimings($array[Event::EVENT_TIMINGS]); return $instance; }
/** * Duplicates a job with similar properties to the original. * * @return NineThousand\Jobqueue\Vendor\Doctrine\Adapter\Job\DoctrineJobAdapter */ public function spawn() { $entity = new JobEntity; $entity->setRetry($this->_jobEntity->getRetry()); $entity->setCooldown($this->_jobEntity->getCooldown()); $entity->setMaxRetries($this->_jobEntity->getMaxRetries()); $entity->setAttempts(0); $entity->setExecutable($this->_jobEntity->getExecutable()); $entity->setType($this->_jobEntity->getType()); $entity->setStatus(null); $entity->setCreateDate(new \DateTime("now")); $entity->setLastRunDate(null); $entity->setActive(1); $entity->setSchedule(null); $entity->setParent($this->_jobEntity->getId()); $this->_em->persist($entity); $this->_em->flush(); //instantiate duplicated job adapter and set params, args, tags $jobAdapter = new self($this->_options, $entity, $this->_em, $this->_logger); if (count($params = $this->getParams())) $jobAdapter->setParams($params); if (count($args = $this->getArgs())) $jobAdapter->setArgs($args); if (count($tags = $this->getTags())) $jobAdapter->setTags($tags); return $jobAdapter; }