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;
            }
        }
    }
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;
            }
        }
    }
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 ; } } }
Reload the current Model

TODO fetchColumns instead of self::getOneByKey() to only update column values
Reload the current Model