CRUD icon indicating copy to clipboard operation
CRUD copied to clipboard

[4.0] Make sure routes can be generated even if developer uses phpcbf; don't generate route and sidebar item if it already exists

Open tabacitu opened this issue 5 years ago • 1 comments

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

tabacitu avatar Mar 11 '20 10:03 tabacitu

A new inspection was created.

scrutinizer-notifier avatar Mar 11 '20 10:03 scrutinizer-notifier