Variable.php 719 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. class Variable extends MongoAr
  3. {
  4. public $_id;//配置名作为主键
  5. public $value;
  6. public function __construct($scenario='insert'){
  7. $this->setMongoDBComponent(Yii::app()->getComponent('mongodb_data'));
  8. parent::__construct($scenario);
  9. }
  10. public static function model($className=__CLASS__)
  11. {
  12. return parent::model($className);
  13. }
  14. public function getCollectionName()
  15. {
  16. return 'variable';
  17. }
  18. public function parseRow($row,$output=array()){
  19. $newRow = array();
  20. $newRow['key'] = (string)$row['_id'];
  21. $newRow['value'] = CommonFn::get_val_if_isset($row,'value',0);
  22. return $this->output($newRow,$output);
  23. }
  24. }