platform icon indicating copy to clipboard operation
platform copied to clipboard

Quickstart example throws exception

Open Liburia opened this issue 1 year ago • 4 comments

https://orchid.software/en/docs/quickstart-crud/

When trying to create a post, I get an exception Call to a member function fill() on null at line $this->post->fill($request->get('post'))->save();

Liburia avatar Sep 12 '23 10:09 Liburia

try instead $post->fill($request->get('post'))->save();

surajtiwari06 avatar Sep 15 '23 05:09 surajtiwari06

There is no $post anywhere in the scope, therefore, it understandably gives an undefined variable exception.

Liburia avatar Sep 15 '23 07:09 Liburia

Hello, I'm sorry to inform you that the issue has been poorly documented and lacks the necessary data that could be of assistance, such as the package version.

In case the value of $post is null, it is highly probable that you have either not defined a public property or are using previous versions of the package.

tabuna avatar Sep 15 '23 19:09 tabuna

Hello.

I am using "orchid/platform": "^14.0" and the Screen's content is a straight copy-paste from the docs page.

public $post; is defined. Moreover, the post injection works properly in the name method.

    public function name(): ?string
    {
        return $this->post->exists ? 'Edit post' : 'Creating a new post';
    }

Liburia avatar Sep 24 '23 19:09 Liburia