tracker issue : CF-3040398

select a category, or use search below
(searches all categories and all time range)
Title:

Bug 80630:For non-persistent objects (

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/

Reporter/Name(from Bugbase): Derrick Rapley / Derrick Rapley (adrapley)

Created: 11/10/2009

Components: Language, CF Component

Versions: 9.0

Failure Type: Unspecified

Found In Build/Fixed In Build: 251028 /

Priority/Frequency: Normal / Unknown

Locale/System: English / Win All

Vote Count: 0

Problem:

For non-persistent objects (.ie. persistent="false"), the 'default' attribute for the 'property' meta data does not set a default value.
Method:

1) CREATE CFCcomponent accessors="true" persistent="false"  {property name="firstName" default="abcd";property name="lastName" default="efgh";public Artists function init() {return this;}}2) OUTPUT DATA<cfdump var="#artists.getFirstName()#"/><cfdump var="#artists.getLastName()#"/><cfoutput>#artists.getFirstName()#</cfoutput><cfoutput>#artists.getLastName()#</cfoutput>HOWERVERIf I make the cfc persistentcomponent accessors="true" persistent="true" table="Artists"  {property name="artistid" fieldtype="id" generator="native"; property name="firstName" default="abcd";property name="lastName" default="efgh";public Artists function init() {return this;}}The 'property' meta data 'default' attribute sets the default values like it should.CURRENT WORKAROUNDS  for non-persistent objects1) set default values with setters in the constructorcomponent accessors="true" persistent="false"  {property name="firstName";property name="lastName";public Artists function init() {setFirstName('abcd');setLastName('efgh');return this;}}2) USE PARAM/CFPARAMcomponent accessors="true" persistent="false"  {property name="firstName";property name="lastName";param name="firstName" default="abcd";param name="lastName" default="efgh";public Artists function init() {return this;}}NOTE: using param/cfparam will create keys (for firstName, lastName, etc.) as upper case in your variables scope, where as using setters in the constructor will preserve the case used in the 'property' meta data
Result:

There's no error message here, just counterintuitive behavior, or it just doesn't work.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3040398

External Customer Info:
External Company:  
External Customer Name: Derrick Rapley
External Customer Email: 5AD859C746448E10992016B7
External Test Config: 11/10/2009

Attachments:

Comments: