예제 #1
0
 public function save()
 {
     $this->subscriptionClassKey = PhabricatorHash::digestForIndex($this->subscriptionClass);
     $this->subscriptionRefKey = PhabricatorHash::digestForIndex($this->subscriptionRef);
     $is_new = !$this->getID();
     $this->openTransaction();
     // If we're saving this subscription for the first time, we're also
     // going to set up the trigger for it.
     if ($is_new) {
         $trigger_phid = PhabricatorPHID::generateNewPHID(PhabricatorWorkerTriggerPHIDType::TYPECONST);
         $this->setTriggerPHID($trigger_phid);
     }
     $result = parent::save();
     if ($is_new) {
         $trigger_action = new PhabricatorScheduleTaskTriggerAction(array('class' => 'PhortuneSubscriptionWorker', 'data' => array('subscriptionPHID' => $this->getPHID()), 'options' => array('objectPHID' => $this->getPHID(), 'priority' => PhabricatorWorker::PRIORITY_BULK)));
         $trigger = $this->getTrigger();
         $trigger->setPHID($trigger_phid);
         $trigger->setAction($trigger_action);
         $trigger->save();
     }
     $this->saveTransaction();
     return $result;
 }
예제 #2
0
 public function save()
 {
     $this->productClassKey = PhabricatorHash::digestForIndex($this->productClass);
     $this->productRefKey = PhabricatorHash::digestForIndex($this->productRef);
     return parent::save();
 }
예제 #3
0
 public function save()
 {
     if (!$this->getMailKey()) {
         $this->setMailKey(Filesystem::readRandomCharacters(20));
     }
     return parent::save();
 }