예제 #1
0
 /**
  * Converts a currency doctrine model to a currency struct
  *
  * @param \Shopware\Models\Shop\Currency $currency
  * @return Struct\Currency
  */
 public function convertCurrency(Models\Shop\Currency $currency)
 {
     $struct = new Struct\Currency();
     $struct->setId($currency->getId());
     $struct->setName($currency->getName());
     $struct->setCurrency($currency->getCurrency());
     $struct->setFactor($currency->getFactor());
     $struct->setSymbol($currency->getSymbol());
     return $struct;
 }
예제 #2
0
 /**
  * @param CurrencyEntity $currency
  * @return Currency
  */
 public static function createFromCurrencyEntity(CurrencyEntity $currency)
 {
     $struct = new self();
     $struct->setId($currency->getId());
     $struct->setName($currency->getName());
     $struct->setCurrency($currency->getCurrency());
     $struct->setFactor($currency->getFactor());
     $struct->setSymbol($currency->getSymbol());
     return $struct;
 }
예제 #3
0
 public function createCurrency(array $data = array())
 {
     $currency = new Models\Shop\Currency();
     $data = array_merge(array('currency' => 'PHP', 'factor' => 1, 'name' => 'PHP', 'default' => false, 'symbol' => 'PHP'), $data);
     $this->deleteCurrency($data['name']);
     $currency->fromArray($data);
     $this->entityManager->persist($currency);
     $this->entityManager->flush();
     $this->entityManager->clear();
     $this->createdCurrencies[] = $data['name'];
     return $currency;
 }
 /**
  * {@inheritDoc}
  */
 public function setManyToOne($data, $model, $property)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setManyToOne', array($data, $model, $property));
     return parent::setManyToOne($data, $model, $property);
 }