Beispiel #1
0
 public function checkCredentials($params, $modelName = null)
 {
     if (empty($modelName)) {
         $modelName = $this->_userModelName;
     }
     if (!empty($params['password'])) {
         $params['password'] = md5($params['password']);
     }
     /**
      * @var Model $user
      */
     $user = call_user_func(array($modelName, 'loadOne'), QC::createFromCondition($params));
     if ($user->isExists()) {
         $this->_storage['user'] = $user->getArray();
         return true;
     } else {
         return false;
     }
 }
Beispiel #2
0
 /**
  * @param QC|null $criteria
  * @return ModelCollection
  */
 protected function _loadList($criteria)
 {
     /**
      * @var QC $criteria
      * @var QC $qc
      */
     if (is_object($criteria) && $criteria->getModifier('rawSelect')) {
         $qc = $criteria;
     } else {
         $qc = QC::create($this->_tableName);
         if (!empty($criteria)) {
             $criteria = $this->_model->_processCriteria($criteria);
             if (is_array($criteria)) {
                 $criteria = QC::createFromCondition($criteria);
             }
             $qc->importQC($criteria);
             $qc->and($criteria);
         }
     }
     $this->_preLoad($qc);
     $data = $qc->execute();
     if (empty($data)) {
         $data = array();
     }
     $this->_data = array();
     $index = 0;
     foreach ($data as $item) {
         /**
          * @var Model $object
          */
         $object = new $this->_modelClass();
         $object->setOriginalData($item);
         $object->_setCollectionReference($this);
         $this->_data[] = $object;
         $this->_pk_map[$object[$this->_primaryKey]] = $index++;
     }
     $this->_postLoad();
     return $this;
 }