Recently I stumbled upon an issue with hidden reserved function names
in ColdFusion (see:
http://www.coldfusionjedi.com/index.cfm/2011/5/9/Interesting-issue-with-reserved-function-names-inside-CFCs).
Because of this, I've decided to make some non-backwards compatible
changes to ColdMVC.
First, I'm removing the Model._set(key, value) and Model._get(key)
methods from the base model (coldmvc.Model) and replacing them with a
single Model.prop(key [, value]) method. The prop() method works
similar to prop() and attr() in jQuery, where the method is both a
getter or a setter depending on the number of arguments.
Second, I've decided to perform some general maintenance on the
Model.populate() method. Previously, there was some relatively cryptic
logic that attempted to be smart about what you were trying to do by
modifying the incoming arguments. For example, it would remove
underscores and trim off a trailing "ID" if the property couldn't be
found. For example, user.populate(firstName="Tony") and
user.populate(first_name="Tony") would be equivalent. While this could
be considered useful by some people, in my opinion it encourages
sloppiness in naming conventions. Since this is a convention-based
framework, I'm choosing to side in favor of strong conventions.
Now, populate() simply loops over the incoming struct and delegates
all population responsibility to the prop() method, which in turn
delegates to the base DAO. While this doesn't really affect you
directly, the code behind the scenes is much cleaner and easier to
test.
I'm going to be checking these changes into GitHub tonight as part of
version 1.2.0. Let me know if you have any questions.