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;
    }
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;
    }
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 ; }
Internal loading funciton. Do not use. OK to override.
Internal loading funciton . Do not use . OK to override .