If I'm extending the application.cfc of the root f...
# cfml-general
b
If I'm extending the application.cfc of the root from an application.cfc in a subfolder, can the onSessionStart function reference the super properties of the onApplicationStart?
a
What do you mean by "the super properties of the onApplicationStart"? The short version is though: yes, Application.cfc follows the same inheritance rules as any other CFC in CFML.
b
For example: if (super.onApplicationStart(arguments.Page)) {
a
onApplicationStart
doesn't receive any arguments, as far as I'm aware? Also: the only place one ought to be calling
super.onApplicationStart
from is the subclass's
onApplicationStart
. It doesn't make sense to actively call it from anywhere else.
What are you trying to do, and how is it not working? And no need to be economic with yer words... use enough for it to be clear to someone who is not a) in your brain; b) in front of your code to know what yer doing 😉
(yeah none of the CF docs, Lucee docs or cfdocs indicate
onApplicationStart
receives any arguments. Its method sig is just
boolean onApplicationStart()
b
I'm trying valiantly to follow some of Ben Nadel's articles, so I won't claim to fully understand what I'm doing. I'm trying to fix some old code that has application.cfm/cfcs scattered all throughout. At first I thought I could move everything into the root application.cfc, but then discovered some things that didn't seem like they would work with that. I'll re-evaluate and try to clarify Monday if I can't figure it out. I probably shouldn't post so late on a Friday. lol Thanks!
a
Gotcha. Actively ping me when you re-post and I'll try to help. We'll nail it.
c
Has something changed in recent versions of CF that allows an Application.cfc to extend another Application.cfc? IIRC, there was some hassle with having to create an intermediary CFC (for purposes of explanation let's call it MyApplication.cfc) that extended an Application.cfc, and then another Application.cfc could extend MyApplication.cfc. @Brian didn't specify whether he's using Adobe ColdFusion or Lucee (which I think might actually allow this).
a
@cfvonner yeah one has to monkey around the extend the root-level Application.cfc still. Either have an extra mapping to that dir, so one can reference it as
thatMapping.Application
, or use like an
ApplicationProxy
adjacent to it.
b
So I am using ACF 2021 and yes, I am using the application proxy. Part of what's confusing me is what the person who wrote this app is trying to do. It looks like when you're in a branch of the app it sets an application variable to a value relevant to that branch. However, when you go to a different branch of the app it checks to see if that value is set. If it is, it leaves it alone. If not, it sets it, possibly to a value particular to that branch of the app. Which means if you change branches, that variable could have a value that is no longer applicable, but it won't be changed. Looks like I'll have a few less hairs tomorrow...
a
That sounds like a logic error / design error to me. I suspect there ought to be separate applications per branch, with some shared behaviour defined in a base application.
b
I'm working with the SMEs to try to eliminate the application.cfc files in the branches and only have the one at the root, eliminating the issue. Wish me luck.
🍀 1