コード例 #1
0
 private static function storeSwitcher($storeType)
 {
     switch ($storeType) {
         case self::STORE_TYPE_CONTROLLER:
             return ControllerStore::getInstance();
             break;
         case self::STORE_TYPE_MODEL:
             return ModelStore::getInstance();
             break;
         case self::STORE_TYPE_LIBRARY:
             return LibraryStore::getInstance();
             break;
         default:
             return false;
     }
 }
コード例 #2
0
 public function construct()
 {
     $cols = array();
     if ($this->collection) {
         $cols = $this->model->framework->mongodb->listCollections();
     }
     $count = 0;
     foreach ($cols as $i => $v) {
         if ($this->collection == $v->getName()) {
             $count++;
         }
     }
     if ($count == 0) {
         $this->_create();
     }
     if ($count > 1) {
         exit("too many collections with the same name");
     }
     $this->collectionref = $this->model->framework->mongodb->selectCollection($this->collection);
     parent::construct();
 }
コード例 #3
0
 public function parseFilters($filters = array())
 {
     return $this->logic(ModelStore::logic($this->filters, $filters));
 }
コード例 #4
0
 public function filter($filters = array(), $start = 0, $limit = 0)
 {
     if ($this->has && $limit) {
         $ids = $this->collect($this->id, $filters, $start, $limit);
         $filters = ModelStore::logic($filters, array(array($this->id, "in", $ids)));
         $limit = 0;
     }
     $records = parent::filter($filters, $start, $limit);
     if ($this->has) {
         $records = $this->_has($records);
     }
     return $records;
 }