cakephp / upgrade

Upgrade tools for CakePHP meant to facilitate migrating from one version of the framework to another
MIT License
110 stars 60 forks source link

Missing upgrade elements #290

Open dereuromark opened 2 weeks ago

dereuromark commented 2 weeks ago

Just adding them as note for now, if someone wants to tackle those

 use Cake\Routing\RouteBuilder;

-Router::prefix('Admin', function (RouteBuilder $routes) {
+$routes->prefix('Admin', function (RouteBuilder $routes) {
    $routes->plugin('Management', function (RouteBuilder $routes) {
        $routes->fallbacks();
    });
 });

-Router::plugin('Management', function (RouteBuilder $routes) {
+$routes->plugin('Management', function (RouteBuilder $routes) {
    $routes->fallbacks();
 });

for plugin routes.php files


if ($this->RequestHandler->prefers('rss'))

replacement

dereuromark commented 2 weeks ago
-$this->set('_serialize', 'result');
+$this->viewBuilder()->setOption('serialize', 'result');

as well as

-TableRegistry::get()
+TableRegistry::getTableLocator()->get()

also was sth that needed to be done manually it seems.

LordSimal commented 2 weeks ago

I think the recommended way to fetch table instances is via the LocatorAwareTrait, not directly from the TableRegistry, right?

If so then we'd need to add the trait via rector as well and replace it with

$this->fetchTable();
dereuromark commented 2 weeks ago

Sure but for now the quick way would be a simpler replace. Either way works.

markstory commented 2 weeks ago

Sure but for now the quick way would be a simpler replace. Either way works.

While the simple replacement isn't the most correct, the upgrade process will be smoother if we had the simple method replacement.