2017-Jan-24: The Case of the Missing Method

<– Back to all “Work Diary” entries

Ran into an issue where the FW/1 ORM (FW/1 is an Adobe Coldfusion MVC framework) was telling me that a method bar() couldn’t be found for object foo. Since I knew 100% that the method did indeed exist on that entity, I was confused and a bit annoyed.

About 30 minutes of fruitless debugging and searching, I finally ran across a post by someone who’d run into the same issue. Turns out the method I was using to get the entity out of the DB in the first place was returning an array, but for some reason the array was doubled, like:

    [ foo ]

I’m not sure why the extra array was getting added, but turns out I was actually calling the method on the second array vs. the object in the array. Doubly confusing since I felt that I’d already pulled the object out of the array! The same issue bit a coworker about two days later… 😒

Key Takeaways

  • Dump / print out the objects you’re dealing with and really, really look at the output. It’s super easy to miss something like an extra set of array braces surrounding an object dump. I sure did!
  • Even when I think the computer is being dumb, it’s still me 99.9% of the time. In this case, it was my lack of attention to detail + some weird choices made by the FW/1 ORM programmers…maybe?

<– Back to all “Work Diary” entries