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.0] Make sure routes can be generated even if developer uses phpcbf; don't generate route and sidebar item if it already exists #2537

Closed
wants to merge 5 commits into from

Conversation

tabacitu
Copy link
Member

@tabacitu tabacitu commented Mar 11, 2020

Fixes #2536

Makes the route generator check for these line contents, in this order, and places the route BEFORE that line:

  • // end of generated Backpack routes; DO NOT delete or modify this comment;
  • }); // this should be the absolute last line of this file
  • });
  • nothing?! then the last line of the file - 1;
  • no lines?! ok, then return 0;

In addition:

  • it checks that the route doesn't exist before writing content;
  • sidebar also checks that it doesn't exist before writing content;

Now if you're trying to generate a CRUD that already exists, the end result is similar with the model, view, controller:

Screenshot 2020-03-11 at 12 31 08

@scrutinizer-notifier
Copy link

A new inspection was created.

@tabacitu tabacitu changed the title [4.0] Make sure routes can be generated even if developer uses phpcbf [4.0] Make sure routes can be generated even if developer uses phpcbf; don't generate route and sidebar item it it already exists Mar 11, 2020
@tabacitu tabacitu changed the title [4.0] Make sure routes can be generated even if developer uses phpcbf; don't generate route and sidebar item it it already exists [4.0] Make sure routes can be generated even if developer uses phpcbf; don't generate route and sidebar item if it already exists Mar 11, 2020
tabacitu added a commit that referenced this pull request May 16, 2020
This PR separates from #2537 only this bit of logic - that the sidebar-content and route commands do not introduce duplicates when called.
@tabacitu tabacitu requested a review from promatik September 6, 2021 12:28
@tabacitu tabacitu changed the base branch from master to main July 31, 2022 05:33
@tabacitu tabacitu closed this Oct 17, 2022
@tabacitu tabacitu deleted the fix-generators-64-issue branch October 17, 2022 15:57
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.

Custom Routes fail with phpcbf formatted lines
3 participants