/** * {@inheritDoc} */ public function addRewardOption(RewardOption\RewardOptionInterface $rewardOption) { if (!in_array($rewardOption->getName(), $this->_type->validRewardOptions())) { throw new \LogicException('Reward options of type `' . $rewardOption->getName() . '` cannot be set on rewards with a type of `' . $this->_type->getName() . '`'); } if (null === $this->_rewardOptions) { $this->_rewardOptions = new RewardOption\Collection(); } $this->_rewardOptions->add($rewardOption); }
/** * Add a query for saving the reward option to the database transaction * * @param ConfigInterface $config * @param RewardOptionInterface $rewardOption */ private function _addToTransaction(ConfigInterface $config, RewardOptionInterface $rewardOption) { $this->_transaction->add("\n\t\t\tINSERT INTO\n\t\t\t\trefer_a_friend_reward_option\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\t`value`\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\t:value?s\n\t\t\t\t)\n\t\t", ['rewardConfigID' => $config->getID(), 'name' => $rewardOption->getName(), 'value' => $rewardOption->getValue()]); }