/**
  * Loop through currencies and create a new instance of SetAmount for each one, with the currency applied
  *
  * @param Collection $rewardOptions
  *
  * @return Collection
  */
 public function addSetAmountRewardOptions(Collection $rewardOptions)
 {
     foreach ($this->_currencies as $currency) {
         $option = new SetAmount($this->_translator);
         $option->setCurrency($currency);
         $rewardOptions->add($option);
     }
     return $rewardOptions;
 }
コード例 #2
0
 /**
  * {@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);
 }
コード例 #3
0
 /**
  * {@inheritDoc}
  */
 public function load(ConfigProxy $config)
 {
     $result = $this->_qbFactory->getQueryBuilder()->select($this->_columns)->from('refer_a_friend_reward_option')->where('reward_config_id = :id?i', ['id' => $config->getID()])->getQuery()->run();
     $rewardOptions = new Collection();
     foreach ($result as $row) {
         $rewardOption = $this->_rewardOptions->get($row->name);
         $rewardOption->setValue($row->value);
         $rewardOptions->add($this->_rewardOptions->get($row->name));
     }
     return $rewardOptions;
 }