Gavin,

I often add a method to my decorator that accepts the ID for a manytoone
relationship and then sets the proper object relationship using that ID.
Something like

   <cffunction name="setIssueTypeId" access="public" output="false"
returntype="void">
        <cfargument name="IssueTypeId" type="numeric" required="true">
        <cfset var issueType=
getTransfer().get("IssueType",arguments.IssueTypeId)>
        <cfset getTransferObject().setIssueType(issueType) />
    </cffunction>

Some folks do not like this convention, but I do because it encapsulates the
object composition process directly in the business object.

Paul

On Fri, Nov 21, 2008 at 5:02 AM, Chris Peterson <[EMAIL PROTECTED]>wrote:

> and sorry, I mis-typed in there:
>
> <cfset session.generalCAR.setissueType(transfer.get("issueType",
> form.issueTypeId)) />
>
> something more like that =)
>
>
>
> On Fri, Nov 21, 2008 at 7:45 AM, Chris Peterson <[EMAIL PROTECTED]>wrote:
>
>> you have to add an *object* there, not an ID.
>>
>> Try:
>>
>> <cfset session.generalCAR.setissueType(transfer.get("issueType", type,
>> form.issueTypeId) />
>>
>> when you run a 'set' against a related object, you have to 'set' the
>> object, not the object's primary key value =)
>>
>> Chris Peterson
>>
>>
>> On Fri, Nov 21, 2008 at 7:30 AM, Gavin Baumanis <[EMAIL PROTECTED]>wrote:
>>
>>>
>>> Hi There ,
>>>
>>> I seem to be having ongoing issue with getting transfer to to the most
>>> simplest  of tasks.
>>>
>>> If I dump the object I see all the methods that are automatically
>>> created for me via transfer - so far so good and I can see the methods
>>> for setting / getting the fields I have declared in my XML.
>>>
>>> Specifically I see a method "setisuetype"
>>>
>>> issue type is a manytoone with the following declaration in my XML;
>>>
>>> <object name="issueType" table="tbl_issueType">
>>>        <id name="id_tbl_issueType" type="numeric" />
>>>        <property name="issueType" type="string" />
>>> </object>
>>>
>>> <object name="generalCAR" table="tbl_CAR">
>>>        <manytoone name="issueType">
>>>                <link to="car.issueType" column="issueTypeId" />
>>>        </manytoone>
>>> ...
>>> </object>
>>>
>>> Now if I have the following in my form's action page;
>>>
>>> <cfset session.generalCAR.setissueType(form.issueTypeId) />
>>>
>>> then I get the following error;
>>>
>>> The TRANSFER argument passed to the setissueType function is not of
>>> type transfer.com.TransferObject.
>>> If the component name is specified as a type of this argument, its
>>> possible that a definition file for the component cannot be found or
>>> is not accessible.
>>>
>>> Huh?
>>> If I dump the session.generalCAR, then the method is there..
>>>
>>> I tried by creating an issueType object with the following;
>>> session.issueType = application.transfer.new("car.issueType");
>>>
>>> And then I can successfully do this;
>>> <cfset session.issueType.setissueType(form.issueTypeId) />
>>>
>>> But from my previous post(thread)  that seems to have goteen a little
>>> butchered when Kevin's email client misbehaved....
>>> I was given the advice that I didn't need to do this and that I should
>>> ust use the generalCAR.setissueType method,
>>>
>>> Have I missed something? mis-understood the replies - or am I just a
>>> completely mad nutter!
>>>
>>>
>>>
>>
>>
>> --
>> Hey! I dont tell you how to tell me what to do, so dont tell me how to do
>> what you tell me to do! ~ Bender (Futurama)
>>
>
>
>
> --
> Hey! I dont tell you how to tell me what to do, so dont tell me how to do
> what you tell me to do! ~ Bender (Futurama)
>
> >
>


-- 
Paul Marcotte
Fancy Bread - in the heart or in the head?
http://www.fancybread.com

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to