I'm actually running into issues of losing my decorator methods after using
the setTransferObject(TO). I haven't had time to debug yet (as this is not a
production app yet).
I do this inside a "myDecoratedObject" called someobject:
<cfset TO = getTransfer().readByPropertyMap("myDecoratedObject",filter) />
<cfif TO.getIsPersisted()>
<cfset setTransferObject(TO) />
<cfelse>
<!--- code that initializes this object based on the filter and saves it
--->
</cfif>
After running this code, randomly (haven't investigated yet; believe it
somehow related to my filter). "someobject" loses all of its decorator
methods until I clear the transfer cache.
Bob, I read your blog post:
http://www.silverwareconsulting.com/index.cfm/2008/7/22/How-I-Use-Transfer--Part-IX--My-Abstract-Transfer-Decorator-Object--The-Populate-Method
And i think I will try that out whenever I go back to working on my project.
Thanks for the tip!
Mark, any plans for implementing something similar?
Thanks,
John
On Thu, Nov 5, 2009 at 12:11, Jim Rising <[email protected]> wrote:
> Mark,
>
> Thanks. I'll look into it a bit further.
>
> -jim
>
>
>
> On Thu, Nov 5, 2009 at 1:14 PM, Mark Mandel <[email protected]> wrote:
>
>> Probably because you are using a variety of undocumented badness :o(
>>
>> getMemento() , switching out the inner object if a Decorator... all sounds
>> pretty bad if you ask me.
>>
>> I think Bob's approach of using his memento function is probably the way
>> to go.
>>
>> Mark
>>
>>
>>
>> On Fri, Nov 6, 2009 at 6:07 AM, Jim Rising <[email protected]>wrote:
>>
>>> ok... so here is what I did in my decorator:
>>>
>>> <cffunction name="copyContentTemplate">
>>> <cfargument name="contentTemplate"
>>> type="transfer.com.transferObject" required="true">
>>> <cfset var contentTemplate = arguments.contentTemplate>
>>> <cfset var content = getTransfer().get("content.Content", "")>
>>>
>>> <cfset content = setTransferObject(contentTemplate)>
>>> </cffunction>
>>>
>>> now... this does seem to copy a 'contentTemplate' TO into a 'content' TO
>>> without any issues, but when i attempt to save using the following:
>>>
>>> <cffunction name="saveContent" access="public" returntype="any">
>>> <cfargument name="content" type="transfer.com.transferObject"
>>> required="true">
>>> <cfset var content = arguments.content>
>>>
>>> <cfset getTransfer().save(content)>
>>>
>>> </cffunction>
>>>
>>> the object does not save.
>>>
>>> any ideas?
>>>
>>> -jim
>>>
>>>
>>>
>>> On Thu, Oct 29, 2009 at 11:21 AM, John Watson <[email protected]>wrote:
>>>
>>>> Someone who knows a little more detail about how the caching works may
>>>> say what I suggest is a bad a idea, but here's a method I've used with no
>>>> issues yet.
>>>>
>>>> Inside the decorator I've used the TO.setTransferObject(otherTO) method.
>>>> Though both the setting object and the TO object are both the same (IE:
>>>> content/content).
>>>>
>>>> Another idea may be to use setMemento(mementoStruct)
>>>>
>>>> John
>>>>
>>>>
>>>> On Thu, Oct 29, 2009 at 09:10, Jim Rising <[email protected]>wrote:
>>>>
>>>>> I'm needing to copy one TO to another TO, and wondered if anyone had
>>>>> any ideas on the best way to do that? Basically I have one TO that needs
>>>>> to
>>>>> serve as a 'template' of another.
>>>>>
>>>>> Example:
>>>>>
>>>>> I have a TO called 'contentTemplate' and another called 'content'.
>>>>> I want to be able to create a 'content' object from the
>>>>> 'contentTemplate' object.
>>>>>
>>>>> I'm thinking I will need to just get / set everything between each of
>>>>> them, but was hoping I would have another option available.
>>>>>
>>>>> Thanks!
>>>>> --
>>>>> Jim Rising
>>>>> Serial Entrepreneur
>>>>> Software Engineer
>>>>> Web Developer
>>>>>
>>>>> "Knowledge work requires both autonomy and accountability."
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Jim Rising
>>> Serial Entrepreneur
>>> Software Engineer
>>> Web Developer
>>>
>>> "Knowledge work requires both autonomy and accountability."
>>>
>>>
>>>
>>
>>
>> --
>> E: [email protected]
>> T: http://www.twitter.com/neurotic
>> W: www.compoundtheory.com
>>
>>
>>
>>
>>
>
>
> --
> Jim Rising
> Serial Entrepreneur
> Software Engineer
> Web Developer
>
> "Knowledge work requires both autonomy and accountability."
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer
You received this message because you are subscribed to the Google Groups
"transfer-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---