original_string: public function refresh()
      {
          $keyName = $this->keyName;
  
          //If we don't have a key we cant refresh
          if (! isset($this->$keyName))
          {
              return;
          }
  
          $dbItem = self::getOneByKey($this->getKey());
  
          //Check if we are already the same
          if ($dbItem == $this)
          {
              return;
          }
  
          //Get values from DB & check if they match. Update if needed
          foreach (get_object_vars($dbItem) as $var => $val)
          {
              if ($this->$var !== $val)
              {
                  $this->$var = $val;
              }
          }
      }
code: public function refresh()
      {
          $keyName = $this->keyName;
  
          //If we don't have a key we cant refresh
          if (! isset($this->$keyName))
          {
              return;
          }
  
          $dbItem = self::getOneByKey($this->getKey());
  
          //Check if we are already the same
          if ($dbItem == $this)
          {
              return;
          }
  
          //Get values from DB & check if they match. Update if needed
          foreach (get_object_vars($dbItem) as $var => $val)
          {
              if ($this->$var !== $val)
              {
                  $this->$var = $val;
              }
          }
      }
code_tokens: public function refresh ( ) { $ keyName = $ this -> keyName ; //If we don't have a key we cant refresh if ( ! isset ( $ this -> $ keyName ) ) { return ; } $ dbItem = self :: getOneByKey ( $ this -> getKey ( ) ) ; //Check if we are already the same if ( $ dbItem == $ this ) { return ; } //Get values from DB & check if they match. Update if needed foreach ( get_object_vars ( $ dbItem ) as $ var => $ val ) { if ( $ this -> $ var !== $ val ) { $ this -> $ var = $ val ; } } }
docstring: Reload the current Model
  
  TODO fetchColumns instead of self::getOneByKey() to only update column values
docstring_tokens: Reload the current Model