Need assistance w/ package migration from 5.6 -> 5.7

Permalink
Howdy & thanks for looking.

I'm migrating a package from 5.6 to 5.7 and have spent today caught on this issue.

This package installs w/out error after implementing namespaces, but its view is not registering its associated controller. Doing a var_dump on $this in the view shows me that it's relegating to the Concrete\Core\Page\Controller\PageController instead of the desired controller.

The view is using the default name "view.php".

View's location is:
/packages/PACKAGE_NAME/single_pages/dashboard/product_manager/view.php

Controller's location is:
/packages/PACKAGE_NAME/controllers/single_page/dashboard/product_manager/controller.php

Looking for assistance in finding:
- The appropriate location / naming system for the Controller to get it to bind properly or,
- A way to get more verbose debugging information to help understand what's not being detected.

Thanks.

meandmybadself
 
meandmybadself replied on at Permalink Reply
meandmybadself
Additionally, when I attempt to follow a form action (e.g.
$addaction = $view->action('add');

it results in a 404.
goldhat replied on at Permalink Best Answer Reply
Your controller location should be /packages/PACKAGE_NAME/controllers/single_page/dashboard/product_manager.php. And the class should be defined with the name as below:

class ProductManager extends PageController {


This is a change from 5.6 in how controllers are named when your view is in a folder with the "view.php" name. Before, I think you would use "controller.php" inside the same named folder. Now you must use the view folder name as the controller name. Expanded example from Razor Commerce to show how you should name the other controllers for a set of single pages.

Views:
/single_page/shop/view.php
/single_page/shop/checkout/view.php

Controllers:
/controllers/single_page/shop.php
/controllers/single_page/shop/checkout.php
meandmybadself replied on at Permalink Reply
meandmybadself
That did the trick. Thank you for your help. Spent the day chasing ghosts on that one.

And for anyone else who stumbles across this thread looking for answers, you'll also need to update the namespaces of your Controller to match the new format as well.

<?php
namespace Concrete\Package\PACKAGE_NAME\Controller\SinglePage\Dashboard;