示例#1
0
 /**
  * @param \Model\Cond\AbstractCond $cond
  *
  * @throws \Model\Db\Exception\ErrorException
  * @throws \Model\Exception\ErrorException
  * @return mixed
  */
 public function fetchOne(Cond $cond = null)
 {
     $entity = $cond->getEntityName() ? $cond->getEntityName() : $this->getRawName();
     $select = $this->prepareSelect($cond->limit(1), $entity);
     if ($cond->checkCond(Cond::SHOW_QUERY) || $cond->checkCond(Cond::SHOW_QUERY_EXTENDED)) {
         echo '<!--' . $select . "-->\n";
     }
     return $this->db->fetchOne($select->__toString(), $select->getBind());
 }