public function tryLoadRandom()
    {
        // get ID first
        $id = $this->dsql()->order('rand()')->limit(1)->field($this->getElement($this->id_field))->getOne();
        if ($id) {
            $this->load($id);
        }

        return $this;
    }
public function tryLoadRandom()
    {
        // get ID first
        $id = $this->dsql()->order('rand()')->limit(1)->field($this->getElement($this->id_field))->getOne();
        if ($id) {
            $this->load($id);
        }

        return $this;
    }
public function tryLoadRandom ( ) { // get ID first $ id = $ this -> dsql ( ) -> order ( 'rand()' ) -> limit ( 1 ) -> field ( $ this -> getElement ( $ this -> id_field ) ) -> getOne ( ) ; if ( $ id ) { $ this -> load ( $ id ) ; } return $ this ; }
Loads random entry into model
Loads random entry into model