Exemplo n.º 1
0
 /**
  * @param string $priceTypeName
  *
  * @throws \Exception
  *
  * @return \Orm\Zed\Price\Persistence\SpyPriceType
  */
 public function getPriceTypeByName($priceTypeName)
 {
     if (!isset($this->priceTypeEntityByNameCache[$priceTypeName])) {
         $priceTypeEntity = $this->queryContainer->queryPriceType($priceTypeName)->findOne();
         if ($priceTypeEntity === null) {
             throw new \Exception(self::PRICE_TYPE_UNKNOWN . $priceTypeName);
         }
         $this->priceTypeEntityByNameCache[$priceTypeName] = $priceTypeEntity;
     }
     return $this->priceTypeEntityByNameCache[$priceTypeName];
 }
Exemplo n.º 2
0
 /**
  * @param string $name
  *
  * @return \Orm\Zed\Price\Persistence\SpyPriceType
  */
 public function createPriceType($name)
 {
     $priceTypeEntity = $this->queryContainer->queryPriceType($name)->findOneOrCreate();
     $priceTypeEntity->setName($name)->save();
     return $priceTypeEntity;
 }