예제 #1
0
 public function delete(Gyuser_Model_Operator $obj)
 {
     try {
         $table = $this->getDbTable();
         $set = array('status' => 0);
         $where = array('id = ?' => $obj->getId());
         $result = $table->update($set, $where);
         return $result;
     } catch (Exception $e) {
         echo $e;
     }
     /*
             $userObj = new Gyuser_Model_UserDataMapper();
             $userCount = $userObj->GetClientCountByOperatorId($obj);
     
             $result = 0;
             if (!$userCount) {
        $table = $this->getDbTable();
        $where = $table->getAdapter()->quoteInto('id = ?', $obj->getId());
        $result = $table->delete($where);
             }
             return $result;
     */
 }
예제 #2
0
 public function GetClientCountByOperatorId(Gyuser_Model_Operator $obj)
 {
     $table = $this->getDbTable();
     $select = $table->select();
     $select->from($table, 'COUNT(id) AS num');
     $select->where('operator = ?', $obj->getId());
     $row = $table->fetchRow($select);
     return $row->num;
 }