We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Phalcon4 DevTools and incorrect Form Action path?

I'm a little stuck on something in my Phalcon config and need guidance. Everything is relatively new out of the box so I haven't gone off into messing with any defaults, etc.

When adding all the links/references and urls in the scaffold views the url always contains the class/action however the paths with Phalcon serve are resolving relative to the current class, not root.

So basically https://localhost:8000/somecontroller/new gets you the form but the action is set to "somecontroller/create" and because of "something in the mix" the post resolves as https://localhost:8000/somecontroller/somecontroller/create which then of course blows up.

In looking at the tag-linkTo formatting, these also contain the classname so it appears to be what Phalcon expects but it doesn't resolve the same though based on comparing action vs linkto

So I'm sitting here using the tools out of the box but am not sure if I'm (a) missing something basic in the config or routing of the app (b) devtools has a config option I need or (c) if Phalcon serve requires some config to knock this into place.

My assumption here is that the .htaccess should be Apache-ready and likely works with Phalcon Serve in some way, but is just "off" even though I haven't modified them from the initial Phalcon project create.



8.4k

without the code i'm afraid i can't see the problem

but i would recommend setup your database and create your models using phalcon dev-tools

in your phalcon root dir ( check the documentation )

phalcon all-models

then you can create a scaffold for a table that will create a controller ( create, view, edit and delete actions ) and view for that actions

this will point you to the direction where you will learn ( check the documentation )

phalcon scaffold --table-name users