public function loadBy($field, $cond, $value = UNDEFINED)
    {
        if ($field == $this->id_field && $value === UNDEFINED) {
            return $this->load($cond);
        }
        if ($field == $this->id_field && cond === '=') {
            return $this->load($value);
        }

        if ($this->loaded()) {
            $this->unload();
        }
        $this->hook('beforeLoad', array('loadBy', array($field, $cond, $value)));

        $conditions = $this->conditions;
        $this->addCondition($field, $cond, $value);
        $this->controller->loadByConditions($this);
        $this->conditions = $conditions;

        $this->endLoad();

        return $this;
    }
public function loadBy($field, $cond, $value = UNDEFINED)
    {
        if ($field == $this->id_field && $value === UNDEFINED) {
            return $this->load($cond);
        }
        if ($field == $this->id_field && cond === '=') {
            return $this->load($value);
        }

        if ($this->loaded()) {
            $this->unload();
        }
        $this->hook('beforeLoad', array('loadBy', array($field, $cond, $value)));

        $conditions = $this->conditions;
        $this->addCondition($field, $cond, $value);
        $this->controller->loadByConditions($this);
        $this->conditions = $conditions;

        $this->endLoad();

        return $this;
    }
public function loadBy ( $ field , $ cond , $ value = UNDEFINED ) { if ( $ field == $ this -> id_field && $ value === UNDEFINED ) { return $ this -> load ( $ cond ) ; } if ( $ field == $ this -> id_field && cond === '=' ) { return $ this -> load ( $ value ) ; } if ( $ this -> loaded ( ) ) { $ this -> unload ( ) ; } $ this -> hook ( 'beforeLoad' , array ( 'loadBy' , array ( $ field , $ cond , $ value ) ) ) ; $ conditions = $ this -> conditions ; $ this -> addCondition ( $ field , $ cond , $ value ) ; $ this -> controller -> loadByConditions ( $ this ) ; $ this -> conditions = $ conditions ; $ this -> endLoad ( ) ; return $ this ; }
Like tryLoadBy method but if the record not found, an exception is thrown.

@param $field
@param $cond
@param $value

@return $this
Like tryLoadBy method but if the record not found an exception is thrown .