php-router icon indicating copy to clipboard operation
php-router copied to clipboard

Fixed Controller inside subfolder path

Open chrisasek opened this issue 1 year ago • 9 comments

The problem I am trying to fix is that controllers inside a subfolder inside the controllers path aren't working.

I added an alternative search function for controllers inside the controllers' path set in the configuration for not found controllers.

chrisasek avatar Nov 14 '24 12:11 chrisasek

Hi @chrisasek , thanks for your contribution. I'll check your changes and merge it ASAP.

Thanks.

izniburak avatar Nov 16 '24 20:11 izniburak

Alright.

chrisasek avatar Nov 17 '24 11:11 chrisasek

God day @izniburak

I'm still waiting on this.

chrisasek avatar Nov 21 '24 18:11 chrisasek

I'm very busy for this week. Probably I'll check it on weekend. Sorry for the late.

izniburak avatar Nov 21 '24 22:11 izniburak

Alright

On Thu, Nov 21, 2024, 11:52 PM İzni Burak Demirtaş @.***> wrote:

I'm very busy for this week. Probably I'll check it on weekend. Sorry for the late.

— Reply to this email directly, view it on GitHub https://github.com/izniburak/php-router/pull/79#issuecomment-2492517930, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2JGIH3RKXZZND6NAHXWQT2BZP2RAVCNFSM6AAAAABRYZJI66VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJSGUYTOOJTGA . You are receiving this because you were mentioned.Message ID: @.***>

chrisasek avatar Nov 21 '24 22:11 chrisasek

Hi @chrisasek , I checked the current version of the package with the controllers in the subfolder, and I have no any error. BTW, when I checked the your public project, I noticed that some of your definitions are wrong. For instance: autoloads, controllers namespace...

If you check the https://github.com/chrisasek/Dicer-mvc/blob/master/composer.json, You can see the autoload definitions are wrong for your project. Also, If you check https://github.com/chrisasek/Dicer-mvc/blob/55233fc8225b7526e85d127a42ceb10da6ada13c/route/web.php#L7, you can see that the TestController namespace is wrong. Because it's under the controllers/test folder. It must ve Controllers\test\TestController.

I tried to create a new project similar with your public project and I configured all thing I mentioned above correctly, and everything seems normal.

Are you sure all definitions and configurations correct?

izniburak avatar Nov 23 '24 22:11 izniburak

Please make changes to my public project, I'll use that to check, learn, and fix mine.

Thank you.

chrisasek avatar Dec 01 '24 21:12 chrisasek

I found out that this works.

$router->controller('/food-pools', 'company.FoodPoolController');

However, I can't click on the class to access the class file, so it's not as flexible as this.

$router->controller('/food-pools', CompanyFoodPoolController::class);

My changes help, can you merge please 😌 , I'm having a hard time with the above approach.

chrisasek avatar Feb 15 '25 21:02 chrisasek

Oh, my mistake.

Gotten it. Thanks

chrisasek avatar Mar 01 '25 16:03 chrisasek