New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't call `toArray` on an unsaved user #1111

Closed
edalzell opened this Issue Nov 17, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@edalzell

edalzell commented Nov 17, 2016

Expected behaviour

$user->toArray() in a user.registering event returns an array

Actual behaviour

File not found at path: bar.yaml

Steps to reproduce

  1. Create a Listener for user.registering
  2. Call $user->toArray()

Issue is this line in User.php:

    public function supplement()
    {
        $this->supplements['last_modified'] = File::disk('users')->lastModified($this->path());
@edalzell

This comment has been minimized.

Show comment
Hide comment
@edalzell

edalzell Nov 18, 2016

Just noting my fix here so that if I decide to release I can tell people what to do:

        if (File::disk('users')->exists($this->path()))
        {
            $this->supplements['last_modified'] = File::disk('users')->lastModified($this->path());
        }

edalzell commented Nov 18, 2016

Just noting my fix here so that if I decide to release I can tell people what to do:

        if (File::disk('users')->exists($this->path()))
        {
            $this->supplements['last_modified'] = File::disk('users')->lastModified($this->path());
        }

@jasonvarga jasonvarga closed this Jan 10, 2018

edalzell added a commit to edalzell/statamic-charge that referenced this issue Mar 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment