/** * Add a query saving a trigger to the database transaction * * @param ConfigInterface $config * @param TriggerInterface $trigger */ private function _addToTransaction(ConfigInterface $config, TriggerInterface $trigger) { $this->_transaction->add("\n\t\t\tINSERT INTO\n\t\t\t\trefer_a_friend_reward_trigger\n\t\t\t\t(\n\t\t\t\t\treward_config_id,\n\t\t\t\t\t`name`\n\t\t\t\t)\n\t\t\t\tVALUES\n\t\t\t\t(\n\t\t\t\t\t:rewardConfigID?i,\n\t\t\t\t\t:name?s\n\t\t\t\t)\n\t\t", ['rewardConfigID' => $config->getID(), 'name' => $trigger->getName()]); }
/** * {@inheritDoc} */ public function addTrigger(Trigger\TriggerInterface $trigger) { if (!in_array($trigger->getName(), $this->_type->validTriggers())) { throw new \LogicException('Triggers of type `' . $trigger->getName() . '` cannot be set on rewards with a type of `' . $this->_type->getName() . '`'); } if (null === $this->_triggers) { $this->_triggers = new Trigger\Collection(); } $this->_triggers->add($trigger); }