示例#1
0
 public function __construct(array $config = array())
 {
     if (isset($config['amazon'])) {
         $this->_amazon = (array) $config['amazon'];
     }
     parent::__construct($config);
 }
示例#2
0
 public function __construct(array $config = array())
 {
     if (isset($config['proxyModel'])) {
         $this->_proxyModel = $config['proxyModel'];
     }
     parent::__construct($config);
 }
示例#3
0
 public function __construct(array $config = array())
 {
     if (isset($config['fieldName'])) {
         $this->_fieldName = $config['fieldName'];
     }
     if (isset($config['columns'])) {
         $this->_columns = (array) $config['columns'];
     }
     parent::__construct($config);
 }
示例#4
0
 public function __construct(array $config = array())
 {
     if (!isset($config['db'])) {
         $config['db'] = Kwf_Registry::get('dao')->getMongoDb();
     }
     if (isset($config['collection'])) {
         $this->_collection = $config['collection'];
     }
     if (is_string($this->_collection)) {
         $this->_collection = $config['db']->{$this->_collection};
     }
     parent::__construct($config);
 }
示例#5
0
 public function __construct($config = array())
 {
     if (isset($config['tableName'])) {
         $this->_table = new $config['tableName']();
     }
     if (isset($config['table'])) {
         $this->_table = $config['table'];
     }
     if (isset($config['db'])) {
         $this->_db = $config['db'];
     }
     parent::__construct($config);
 }
示例#6
0
 public function __construct(array $config = array())
 {
     if (isset($config['models'])) {
         $this->_models = (array) $config['models'];
     }
     if (isset($config['columnMapping'])) {
         $this->_columnMapping = $config['columnMapping'];
     }
     if (!$this->_models) {
         throw new Kwf_Exception("models setting is required");
     }
     if (!$this->_columnMapping) {
         throw new Kwf_Exception("columnMapping setting is required");
     }
     $allDb = true;
     foreach ($this->_models as $k => $i) {
         if (is_numeric(substr($k, -1))) {
             if (!$this->_columnMapping) {
                 throw new Kwf_Exception("model key '{$k}' must not end numeric");
             }
         }
         foreach (array_keys($this->_models) as $key) {
             if ($key != $k && substr($k, 0, strlen($key)) == $key) {
                 throw new Kwf_Exception("Invalid key '{$k}', another key ('{$key}') also starts with this string");
             }
         }
         if (is_array($i)) {
             if (!isset($i['model'])) {
                 throw new Kwf_Exception("model key for models setting is required");
             }
             if (isset($i['select'])) {
                 $this->_mergeSelects[$k] = $i['select'];
             }
             $i = $i['model'];
         }
         $i = Kwf_Model_Abstract::getInstance($i);
         $this->_models[$k] = $i;
         if (!$i->getFactoryConfig()) {
             $i->setFactoryConfig(array('type' => 'UnionSource', 'union' => $this, 'modelKey' => $k));
         }
         while ($i instanceof Kwf_Model_Proxy) {
             $i = $i->getProxyModel();
         }
         if (!$i instanceof Kwf_Model_Db) {
             $allDb = false;
         }
     }
     $this->_allDb = $allDb;
     parent::__construct($config);
 }
示例#7
0
 public function __construct(array $config = array())
 {
     if (!isset($config['filename'])) {
         throw new Kwf_Exception('No CSV file found');
     }
     if (isset($config['headRow'])) {
         $this->_headRow = $config['headRow'];
     }
     if (!isset($config['delimiter'])) {
         throw new Kwf_Exception('Please set a delimiter');
     }
     $this->_filename = $config['filename'];
     $this->_delimiter = $config['delimiter'];
     parent::__construct($config);
 }
 public function __construct(array $config = array())
 {
     if (isset($config['data'])) {
         $this->setData($config['data']);
     }
     if (isset($config['autoId'])) {
         (int) ($this->_autoId = $config['autoId']);
     }
     if (isset($config['columns'])) {
         $this->_columns = (array) $config['columns'];
     }
     if (isset($config['primaryKey'])) {
         $this->_primaryKey = (string) $config['primaryKey'];
     }
     if (isset($config['uniqueColumns'])) {
         $this->_uniqueColumns = (array) $config['uniqueColumns'];
     }
     parent::__construct($config);
 }