So I was working on something OOP :-). And I am trying to use Hal Hellms BaseComponent.cfc that all CFCs that don't extend anything should extend. For the purpose of this post I reduced it to two methods:
The way I was using it is I included it into ColdFusion component.cfc that all CFCs extend by default:
So I also make test CFC and a cfm page:
When I run cfm file and expend the dump output I see following:
As you can see the objectid() method is missing.
Now I remove the include from component.cfc and make my test component extend BaseComponent
Run cfm again and get following:
Now objectid() method is seen in the dump.
1 comment:
As discussed, the problem is related to a naming conflict between the setting of variables.objectID in the pseudo constructor code and the function named objectID -- ColdFusion hold function names in the variables scope as well. I'm not exactly sure how this works in some cases but not others -- seems to have something to do with the cfinclude processing in this case.
If you learn more details, please update this or post a follow up, as I'm curious to know exactly why this works when extending, but not with the cfinclude of the BaseComponent.cfc. Thanks!
Post a Comment