public function sync($data = false)
    {
        if ($this->_exists !== null) {
            return;
        }
        $id = $this->id();
        if ($id !== null) {
            $persisted = static::load($id);
            if ($persisted && $data) {
                $this->amend($persisted->data(), ['exists' => true]);
            } else {
                $this->_exists = !!$persisted;
            }
        } else {
            $this->_exists = false;
        }
    }
public function sync($data = false)
    {
        if ($this->_exists !== null) {
            return;
        }
        $id = $this->id();
        if ($id !== null) {
            $persisted = static::load($id);
            if ($persisted && $data) {
                $this->amend($persisted->data(), ['exists' => true]);
            } else {
                $this->_exists = !!$persisted;
            }
        } else {
            $this->_exists = false;
        }
    }
public function sync ( $ data = false ) { if ( $ this -> _exists !== null ) { return ; } $ id = $ this -> id ( ) ; if ( $ id !== null ) { $ persisted = static :: load ( $ id ) ; if ( $ persisted && $ data ) { $ this -> amend ( $ persisted -> data ( ) , [ 'exists' => true ] ) ; } else { $ this -> _exists = ! ! $ persisted ; } } else { $ this -> _exists = false ; } }
Sync the entity existence from the database.

@param boolean $data Indicate whether the data need to by synced or not.
Sync the entity existence from the database .