Can't Decipher Form Submission URI routing

edited October 2012 in Bug Reports
I am trying to trace the flow of a form submission from blog posts in the admin module.

The form action attribute is "http://localhost/fuel/blog/posts/edit/1"

This would lead me to expect that the target is the advanced fuel module "blog" and a controller named "posts" and a method named "edit" with a parameter of "1" meaning record 1.

However, I can find no such controller/method. By doing global search on the codebase, I can not find any controller named "posts" that seems to have relevant code, or any method named "edit" in any file that seems to have relevant code. In fact, I cannot find any model or superclass with a method named "edit" that seems to have relevant code.

It seems possible that perhaps the URI resolves somehow to the "blog_posts_model", but I cannot see where this resolution happens, and the "blog_posts_model" does not seem to have an edit method. Additionally, the Base_Module_model that it extends does not have an "edit" method.

I cant seem to find anything in the docs that helps me to trace this code execution (ie, a step-by-step explanation of the steps FuelCMS goes through to resolve URIs), so I am at a loss to follow this part of the code.

Can anyone help?

Yours,

James


(PS, not sure where to put this, I know it's not a bug report, but there is no section titled "How do I do this?" )

Comments

  • edited 4:42AM
    First port of call will be the routes file in the config directory of the blog module.

    I've only got 1.0 to hand (assuming you're on a lower version) and I can see that all blog uri's run through the base fuel/module controller.

    The module.php controller in the fuel directory is the main controller for fuel. In here you'll find create and edit with a host of others.

    Relying on a code search may not always net you a result, especially if say _remap() is being used.
  • edited October 2012
    So if I understand you correctly, "blog/config/blog_routes.php" reroutes the request for "blog/posts/edit" to "blog/module/edit" looking at the "module->edit()" method, it is referencing "$this->model" I can't see where "$this->model" is assigned, but intuitively, it seems it might refer to "blog/models/blog_posts_model.php" Is this correct? If so, where is this assignment made? In some other router or model?

    (Yes, I am on V0.93)

    Yours,
    James
  • edited 4:42AM
    That is correct. The model gets assigned in the constructor of the fuel/modules/fule/controller/module.php controller.
Sign In or Register to comment.