示例#1
0
 /**
  * @param Cond $cond
  * @param null $entity
  *
  * @return array|mixed|null|string
  * @throws \Model\Db\Exception\ErrorException
  * @throws \Model\Exception\ErrorException
  */
 public function execute(Cond $cond = null, $entity = null)
 {
     if (!$cond) {
         return null;
     }
     $result = null;
     switch ($cond->getType()) {
         case Cond::FETCH_ONE:
             $result = $this->fetchOne($cond, $entity);
             break;
         case Cond::FETCH_ALL:
             $result = $this->fetchAll($cond, $entity);
             break;
         case Cond::FETCH_PAIRS:
             $result = $this->fetchPairs($cond);
             break;
         case Cond::FETCH_COUNT:
             $result = $this->fetchCount($cond);
             break;
         case Cond::FETCH_ROW:
             $result = $this->fetchRow($cond, $entity);
             break;
     }
     return $result;
 }