Skip to content
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

[4.1] Clean up Request usage inside CrudController and CrudPanel #2535

Merged
merged 3 commits into from
Mar 14, 2020

Conversation

tabacitu
Copy link
Member

@tabacitu tabacitu commented Mar 11, 2020

In Backpack 4.0, when working inside a ProductCrudController we had:

  • $this->request
  • $this->crud->request

which is superfluous and confusing, since:

  • $this->request never gets overwritten, and is unavailable inside the CrudPanel object; so it's the same exact thing like using Laravel's request() helper - which I'd argue is cleaner and more intuitive (it looks like a global object); so let's use request() instead of $this->request which does nothing extra;
  • $this->crud->request has a setter ($this->crud->setRequest()), but no getter - it's used as a property, which makes it difficult to change what it does;

Needs to be documented

  • inside your ProductCrudControllers, if you're using $this->request, please replace it with request(); that CrudController property is no longer available, since it basically did the same thing as request();
  • inside your ProductCrudControllers, if you're using $this->crud->request, please replace it with its setter or getter ($this->crud->getRequest() or $this->crud->setRequest()); the property is now protected;

@scrutinizer-notifier
Copy link

A new inspection was created.

@tabacitu tabacitu changed the title [4.1] clean up crudcontroller constructor [4.1] Clean up Request objects inside CrudController and CrudPanel Mar 11, 2020
@tabacitu tabacitu changed the title [4.1] Clean up Request objects inside CrudController and CrudPanel [4.1] Clean up Request usage inside CrudController and CrudPanel Mar 11, 2020
@tabacitu tabacitu changed the base branch from master to 4.1 March 14, 2020 06:29
@tabacitu tabacitu merged commit 9398f6b into 4.1 Mar 14, 2020
@tabacitu tabacitu deleted the clean-up-crud-controller-constructor branch March 14, 2020 06:31
@tabacitu
Copy link
Member Author

Merged into 4.1 - PR #2508
Documented.

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

Successfully merging this pull request may close these issues.

2 participants