original_string: protected function _load($id, $ignore_missing = false)
      {
          /**/$this->app->pr->start('load/selectQuery');
          $this->unload();
          $load = $this->selectQuery();
          /**/$this->app->pr->next('load/clone');
          $p = '';
          if (!empty($this->relations)) {
              $p = ($this->table_alias ?: $this->table).'.';
          }
          /**/$this->app->pr->next('load/where');
          if (!is_null($id)) {
              $load->where($p.$this->id_field, $id);
          }
  
          /**/$this->app->pr->next('load/beforeLoad');
          $this->hook('beforeLoad', array($load, $id));
  
          if (!$this->loaded()) {
              /**/$this->app->pr->next('load/get');
              $s = $load->stmt;
              $l = $load->args['limit'];
              $load->stmt = null;
              $data = $load->limit(1)->getHash();
              $load->stmt = $s;
              $load->args['limit'] = $l;
  
              if (!is_null($id)) {
                  array_pop($load->args['where']);
              }    // remove where condition
              /**/$this->app->pr->next('load/ending');
              $this->reset();
  
              if (@!$data) {
                  if ($ignore_missing) {
                      return $this;
                  } else {
                      throw $this->exception('Record could not be loaded', 'Exception_NoRecord')
                      ->addMoreInfo('model', $this)
                      ->addMoreInfo('id', $id);
                  }
              }
  
              $this->data = $data;  // avoid using set() for speed and to avoid field checks
              $this->id = $this->data[$this->id_field];
          }
  
          $this->hook('afterLoad');
          /**/$this->app->pr->stop();
  
          return $this;
      }
code: protected function _load($id, $ignore_missing = false)
      {
          /**/$this->app->pr->start('load/selectQuery');
          $this->unload();
          $load = $this->selectQuery();
          /**/$this->app->pr->next('load/clone');
          $p = '';
          if (!empty($this->relations)) {
              $p = ($this->table_alias ?: $this->table).'.';
          }
          /**/$this->app->pr->next('load/where');
          if (!is_null($id)) {
              $load->where($p.$this->id_field, $id);
          }
  
          /**/$this->app->pr->next('load/beforeLoad');
          $this->hook('beforeLoad', array($load, $id));
  
          if (!$this->loaded()) {
              /**/$this->app->pr->next('load/get');
              $s = $load->stmt;
              $l = $load->args['limit'];
              $load->stmt = null;
              $data = $load->limit(1)->getHash();
              $load->stmt = $s;
              $load->args['limit'] = $l;
  
              if (!is_null($id)) {
                  array_pop($load->args['where']);
              }    // remove where condition
              /**/$this->app->pr->next('load/ending');
              $this->reset();
  
              if (@!$data) {
                  if ($ignore_missing) {
                      return $this;
                  } else {
                      throw $this->exception('Record could not be loaded', 'Exception_NoRecord')
                      ->addMoreInfo('model', $this)
                      ->addMoreInfo('id', $id);
                  }
              }
  
              $this->data = $data;  // avoid using set() for speed and to avoid field checks
              $this->id = $this->data[$this->id_field];
          }
  
          $this->hook('afterLoad');
          /**/$this->app->pr->stop();
  
          return $this;
      }
code_tokens: protected function _load ( $ id , $ ignore_missing = false ) { /**/ $ this -> app -> pr -> start ( 'load/selectQuery' ) ; $ this -> unload ( ) ; $ load = $ this -> selectQuery ( ) ; /**/ $ this -> app -> pr -> next ( 'load/clone' ) ; $ p = '' ; if ( ! empty ( $ this -> relations ) ) { $ p = ( $ this -> table_alias ? : $ this -> table ) . '.' ; } /**/ $ this -> app -> pr -> next ( 'load/where' ) ; if ( ! is_null ( $ id ) ) { $ load -> where ( $ p . $ this -> id_field , $ id ) ; } /**/ $ this -> app -> pr -> next ( 'load/beforeLoad' ) ; $ this -> hook ( 'beforeLoad' , array ( $ load , $ id ) ) ; if ( ! $ this -> loaded ( ) ) { /**/ $ this -> app -> pr -> next ( 'load/get' ) ; $ s = $ load -> stmt ; $ l = $ load -> args [ 'limit' ] ; $ load -> stmt = null ; $ data = $ load -> limit ( 1 ) -> getHash ( ) ; $ load -> stmt = $ s ; $ load -> args [ 'limit' ] = $ l ; if ( ! is_null ( $ id ) ) { array_pop ( $ load -> args [ 'where' ] ) ; } // remove where condition /**/ $ this -> app -> pr -> next ( 'load/ending' ) ; $ this -> reset ( ) ; if ( @ ! $ data ) { if ( $ ignore_missing ) { return $ this ; } else { throw $ this -> exception ( 'Record could not be loaded' , 'Exception_NoRecord' ) -> addMoreInfo ( 'model' , $ this ) -> addMoreInfo ( 'id' , $ id ) ; } } $ this -> data = $ data ; // avoid using set() for speed and to avoid field checks $ this -> id = $ this -> data [ $ this -> id_field ] ; } $ this -> hook ( 'afterLoad' ) ; /**/ $ this -> app -> pr -> stop ( ) ; return $ this ; }
docstring: Internal loading funciton. Do not use. OK to override.
docstring_tokens: Internal loading funciton . Do not use . OK to override .