We are all pretty familiar with the concept of keywords in programming. These are words we shouldnt use as variables because they are reserved for special use by the compiler.

Where I often forget about them is in frameworks. I was working on an admin for a site today where users can rsvp for events. Sounds easy enough right? Although I dont think event itself is a keyword in Reactor, it turns out that because I was using it in Model-Glue Unity I got myself in a pinch.

Everything was working just fine until I submitted the rsvp form in the admin. Then it errored that the event supplied to my rsvp.setEvent() method was not of the right type. Well I turned off development mode of reactor so it wouldn’t overwrite my file, and I change the setEvent() function to take type any. I then added a cfdump of the arguments scope and cfaborted.

What did I see in my dump output? “rsvp.commit” Thats right. I was using event as the the eventValue in my configuration. Meaning its the variable in my url that decides what actions should be done. Making it a keyword of sorts.

So to fix this I had a couple options. I figure I could change the eventValue for the url. However since “events” are a key peice of Model-Glue and can be used in Reactor, I decided I would be better to change my db. I didnt really want to change the name of my table in the database, so Reactor table aliases to the rescue. My Reactor config used to look like this(-ish ):








But now it looks like this:








Now my rsvp record has a setMeeting() function and doesnt have to know about events and I dont have to worry about keyword conficts. See, it all works out in the end.

Comments are closed.