it seems that even if i do not pass my loginRequired in as part of the
request, it still finds it's way into transfer's where clause with the
default of 'false':

'select name, description, loginRequired, apiEventID from apievents where
loginRequired = false'

the problem seems to be that because arguments.apiEvent.getLoginRequired()
is already set as 'false', loginRequired always evaluates as GT "", and gets
passed into my map. If I change it to anything else via configure() other
than true or false, it is no longer boolean and throws a type error (makes
sense). i have handled this with other data types by checking for the
default value, but the nature of bit values seems to create a paradox where
i can't just obtain a list of true and false records. :)

ultimately what i'm wanting is that if there is nothing passed into the
request scope for 'loginRequired', i don't want it included in the map for
listByPropertyMap.

Here is the relavent portion of my manager:

    <cffunction name="getByAttributesRelated" access="public"
returntype="any">
        <cfargument name="apiEvent" type="transfer.com.transferObject"
required="true">
        <cfargument name="sortBy" type="string" required="false"
default="userID">
        <cfargument name="orderAsc" type="string" required="false"
default="true">

        <cfset var apiEventID = arguments.apiEvent.getApiEventID()>
        <cfset var name = arguments.apiEvent.getName()>
        <cfset var description = arguments.apiEvent.getDescription()>
        <cfset var loginRequired = arguments.apiEvent.getLoginRequired()>

        <cfscript>
        map = StructNew();
        if(apiEventID GT "" and apiEventID NEQ 0)
        {
            map.apiEventID = apiEventID;
        }
        if(name GT "")
        {
            map.name = name;
        }
        if(description GT "")
        {
            map.description = description;
        }
        if(loginRequired GT "")
        {
            map.loginRequired = loginRequired;
        }


        // get a query of the users that match this map
        apiEvents = transfer.listByPropertyMap("apiEvent.ApiEvent", map,
"#arguments.sortBy#", #arguments.orderASC#);


Thanks for the help!

-- 
Jim Rising
Serial Entrepreneur
Software Engineer
Web Developer

"Knowledge work requires both autonomy and accountability."

On Tue, Aug 25, 2009 at 4:27 PM, Mark Mandel <[email protected]> wrote:

> Jim, I'm trying to follow you here...
>
> On Wed, Aug 26, 2009 at 6:41 AM, Jim Rising <[email protected]>wrote:
>
>> just curious if anyone has ever run into any issues with transfer creating
>> default values for boolean?
>
>
> Transfer default boolean values to false, yes. You can override this in a
> configure() method.
>
>
>> what i'm doing, is building a transfer object out of an event into a
>> coldbox handler called 'apiEvent.getByAttributes', and then passing these
>> into a manager i've built called 'apiEvent.getByAttributes'... one of the
>> properties is 'loginRequired', which in mySQL is a tinyInt, and in my
>> transfer config is a boolean. when i instatiate the apiEvent transfer object
>> out of the event scope data (request), and there is no
>> event.getValue("loginRequired"), the getLoginRequired() from transfer
>> defaults to 'false'.
>
>
> Is this a problem? What would you like it to default to (in your
> application context)?
>
>
>> the problem that i am trying to resolve is simply that i would like to
>> retrieve via listByPropertyMap (in the manager) a list of ALL of my
>> apiEvents (irrespective of loginRequired) but also still be able to retrieve
>> apiEvents with loginRequired explicitly declared true or false. it seems
>> that i can only retrieve true or false, but not both because transfer
>> defaults to false. i get why it's doing it, and i've worked around it with
>> other field types... but have not figured out a way to deal with boolean.
>
>
> This is where you lose me. Maybe if you provide an example of what you are
> trying to do?
>
> Mark
>
> --
> E: [email protected]
> T: http://www.twitter.com/neurotic
> W: www.compoundtheory.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