original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Like tryLoadBy method but if the record not found, an exception is thrown.
  
  @param $field
  @param $cond
  @param $value
  
  @return $this
docstring_tokens: Like tryLoadBy method but if the record not found an exception is thrown .