Ejemplo n.º 1
0
 private function getStorage($key)
 {
     if (!self::$data_storages) {
         self::$data_storages = array('tags' => true, 'features_selectable' => 'shopProductFeaturesSelectableModel', 'skus' => true, 'features' => true, 'params' => true, 'categories' => 'shopCategoryProductsModel');
     }
     if (isset(self::$data_storages[$key])) {
         $storage = self::$data_storages[$key];
         if ($storage === true) {
             $storage = "shopProduct" . ucfirst($key) . "Model";
             $obj = new $storage();
             if (!$obj instanceof shopProductStorageInterface) {
                 throw new waException($storage . ' must implement shopProductStorageInterface');
             }
             return self::$data_storages[$key] = $obj;
         } elseif (is_string($storage)) {
             return self::$data_storages[$key] = new $storage();
         } elseif (is_object(self::$data_storages[$key])) {
             return self::$data_storages[$key];
         }
     }
     return null;
 }