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

[BUG[: Error on Route::getRouteId() when mounting collections #16414

Closed
niden opened this issue Aug 24, 2023 Discussed in #16394 · 1 comment · Fixed by #16415
Closed

[BUG[: Error on Route::getRouteId() when mounting collections #16414

niden opened this issue Aug 24, 2023 Discussed in #16394 · 1 comment · Fixed by #16415
Assignees
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: high High

Comments

@niden
Copy link
Sponsor Member

niden commented Aug 24, 2023

Discussed in https://github.com/orgs/phalcon/discussions/16394

Originally posted by hugohiram August 8, 2023
Hello,

I have started migrating a project made on Phalcon 3 to the latest version of Phalcon (5.2.3) with PHP 8.2.8.

When mounting the first collection, I get the following error:
Fatal error: Phalcon\Mvc\Router\Route::getRouteId(): Return value must be of type string, int returned in Unknown on line 0

This is how the code is:

use Phalcon\DI\FactoryDefault;
use Phalcon\Mvc\Micro;
use Phalcon\Mvc\Micro\Collection;
use CustomNamespace\Controllers\AccountController;

$di = new FactoryDefault();
$app = new Micro($di);

$accountCollection = new Collection();
$accountCollection
		->setPrefix('/v1/account')
		//->setHandler('\CustomNamespace\Controllers\AccountController')
		->setHandler(AccountController::class, true);
		//->setLazy(true);
$accountCollection->get('/', 'get');

$app->mount($accountCollection);

I understand that the method "get" has changed the second param to accept a callable as the $handler instead of mixed, but I don't know if its related to the error I am getting. However in the documentation I see that there are examples similar to what I am posting, so I assume that this is still correct.

https://docs.phalcon.io/5.0/en/api/phalcon_mvc#mvc-micro-collection

Any ideas of what is wrong here?

Thanks.

@niden niden self-assigned this Aug 24, 2023
@niden niden added 5.0 The issues we want to solve in the 5.0 release bug A bug report status: high High labels Aug 24, 2023
@niden niden linked a pull request Aug 24, 2023 that will close this issue
5 tasks
@niden
Copy link
Sponsor Member Author

niden commented Aug 24, 2023

This has been resolved in #16415

@niden niden closed this as completed Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: high High
Projects
Status: Released
Development

Successfully merging a pull request may close this issue.

1 participant