Pathfinder issue with nested MVCGrid & MVCForm and the solution

94 Views Asked by At

I am using a structure like this to support moving from upper level related tables down to lower level tables. In general the idea is to either edit a record in the current view or list the child records for that same view through the use of expander columns.

Structurally it is Customer -> Customer Products -> Product Details -> Product Activity.

  Customer     MVCgrid                               ok
    edit           MVCform (via expander column)     ok
    view products  MVCgrid (via expander column)     ok
        edit a product        MVCform                pathfinder error
        view products details MVCGrid                pathfinder error
              edit product details     MVCform
              view product activity    MVCGrid

This structure works at the outer level. I can edit a customer record or view the customer products as expected. When I click on "edit a product" (MVCform) or "view product details" (MVCgrid) I am getting a pathfinder error:

PathFinder_Exception

Unable to include cvCustProducts\cvuidcontrol\cvuiddetails.php

"cvuiddetails" is function name declared as "function page_cvuiddetails()"

I've checked and rechecked everything I can think. It seems to me that the function name is not being made available and pathfinder is being invoked to find out where the page "cvuiddetails" is located and comes up empty.

Any suggestions will be greatly appreciated.

=====[SOLUTION]============================================

Ten minutes later.........

Aha!!!!

Here is the solution to the problem I just posted a few minutes ago and I hope everyone else finds this to be useful:

When nesting the functions, prefix the name of the function with the name of the invoking function

function page_cvuidcontrol() contains the expander column that invokes "cvuiddetails".

ORIGINAL FUNCTION NAME: function page_cvuiddetails()

NEW FUNCTION NAME: function page_cvuidcontrol_cvuiddetails()

1

There are 1 best solutions below

1
On

If you have file page/cvuidcontrol.php you can define page_cvuiddetails() function in that file. This is called sub-pages.

However, take care and make sure you don't name function the same as a class name. It's a very unfortunate coincidence and have gave me problems few times.

class page_details {
    function page_details(){
    }
}

This won't work, because PHP considers this function to be a constructor.