public function checkHasRespondents($userId, $check = false)
    {
        $sql = "CASE
            WHEN EXISTS (SELECT * FROM gems__respondent2org WHERE gr2o_id_organization = gor_id_organization)
            THEN 1
            ELSE 0
            END";
        $values['gor_has_respondents'] = new \Zend_Db_Expr($sql);
        $values['gor_changed']         = new \MUtil_Db_Expr_CurrentTimestamp();
        $values['gor_changed_by']      = $userId;

        $where = $this->db->quoteInto('gor_id_organization = ?', $this->_id);

        if ($this->db->update('gems__organizations', $values, $where)) {
            $this->loadData($this->_id);
        }

        return $this;
    }
public function checkHasRespondents($userId, $check = false)
    {
        $sql = "CASE
            WHEN EXISTS (SELECT * FROM gems__respondent2org WHERE gr2o_id_organization = gor_id_organization)
            THEN 1
            ELSE 0
            END";
        $values['gor_has_respondents'] = new \Zend_Db_Expr($sql);
        $values['gor_changed']         = new \MUtil_Db_Expr_CurrentTimestamp();
        $values['gor_changed_by']      = $userId;

        $where = $this->db->quoteInto('gor_id_organization = ?', $this->_id);

        if ($this->db->update('gems__organizations', $values, $where)) {
            $this->loadData($this->_id);
        }

        return $this;
    }
public function checkHasRespondents ( $ userId , $ check = false ) { $ sql = "CASE
            WHEN EXISTS (SELECT * FROM gems__respondent2org WHERE gr2o_id_organization = gor_id_organization)
            THEN 1
            ELSE 0
            END" ; $ values [ 'gor_has_respondents' ] = new \ Zend_Db_Expr ( $ sql ) ; $ values [ 'gor_changed' ] = new \ MUtil_Db_Expr_CurrentTimestamp ( ) ; $ values [ 'gor_changed_by' ] = $ userId ; $ where = $ this -> db -> quoteInto ( 'gor_id_organization = ?' , $ this -> _id ) ; if ( $ this -> db -> update ( 'gems__organizations' , $ values , $ where ) ) { $ this -> loadData ( $ this -> _id ) ; } return $ this ; }
Check whether the organization still has at least one respondent attached to it.

Does nothing if this is already known.

@param int $userId The current user
@return \Gems_User_Organization (continuation pattern)
Check whether the organization still has at least one respondent attached to it .