[transfer-dev] Re: Column Specified 2x

2009-08-04 Thread Paul Marcotte
Dan,

If you remove the productId property from the review object definition, you
should be golden.  Since that column forms the one to many relationship, you
cannot also specify it as a property.

Paul

On Mon, Aug 3, 2009 at 9:30 PM, Dan Vega danv...@gmail.com wrote:


 I have probably screwed something up here but I can not figure out why
 i am getting this error. I have a product and each product can have
 many reviews. I have  onetomany relationship defined like this.

 ?xml version=1.0 encoding=UTF-8?
 transfer xsi:noNamespaceSchemaLocation=../../transfer/resouces/xsd/
 transfer.xsd xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

objectDefinitions

object name=product table=products
 decorator=unitedcommerce.model.Product
id name=id type=numeric/
property name=name type=string/
property name=author type=string/
property name=url type=string/
property name=price type=numeric/
property name=onSale type=boolean/
property name=screenshot type=string/
property name=thumbnail type=string/
property name=isFeatured type=string/

manytomany name=Category
 table=ProductCategories
link to=product column=productId/
link to=category column=categoryId/
collection type=array
order property=name order=asc/
/collection
/manytomany

onetomany name=review
link to=review column=productId/
collection type=array
order property=dateReviewed
 order=desc/
/collection
/onetomany

/object

object name=category table=categories
id name=id type=numeric/
property name=name type=string/
property name=url type=string/
property name=active type=boolean/
/object

object name=review table=reviews
id name=id type=numeric/
property name=userId type=numeric/
property name=productId type=numeric/
property name=rating type=numeric/
property name=comments type=string/
property name=dateReviewed type=date/
/object

object name=user table=users
 decorator=unitedcommerce.model.User
id name=id type=numeric/
property name=username type=string/
property name=password type=string/
property name=email type=string/
property name=firstname column=fname
 type=string/
property name=lastname column=lname
 type=string/
/object

/objectDefinitions

 /transfer

 When I try to go and save the review (form on the product page) I get
 this error but the record saves just fine.

 Error Executing Database Query.
 Column 'productId' specified twice


 cfif structKeyExists(form,submit)

cfset review = application.transfer.new(review)
cfset review.setUserId(1)
cfset review.setProductId(form.productId)
cfset review.setRating(form.rating)
cfset review.setComments(form.comments)
cfset review.setDateReviewed(now())

cfset product = application.transfer.get(product,form.productId)
cfset review.setParentProduct(product)

cfset application.transfer.save(review)
cflocation url=product.cfm?id=#form.productId# addtoken=false
cfabort
 /cfif
 



-- 
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 transfer-dev@googlegroups.com
To unsubscribe from this group, send email to 
transfer-dev-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~--~~~~--~~--~--~---



[transfer-dev] Wiki Updates

2009-03-20 Thread Paul Marcotte

Hey all,

I just processed some updates to the wiki Tutorials page.  If I missed
anything please let me know.

Cheers,

Paul
--~--~-~--~~~---~--~~
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 transfer-dev@googlegroups.com
To unsubscribe from this group, send email to 
transfer-dev-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~--~~~~--~~--~--~---



[transfer-dev] Re: Wiki Updates

2009-03-20 Thread Paul Marcotte
Sure thing, John, I'll look at it later today.

Paul

On Fri, Mar 20, 2009 at 10:21 AM, John Whish john.wh...@googlemail.comwrote:

 Hey Paul,
 Just had a quick look (didn't realise my posts were listed!). Couple of my
 posts that you may want to remove

 Transfer and IBO (John 
 Whish)http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/173

 Using Paul Marcotte's Metro (John 
 Whish)http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/177

 As in this context IBO is not a great solution and also I think the Metro
 post talks about deprecated features.

 You might want to add this post.

 http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/modelling-a-properties-map-with-transfer-194




 



-- 
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 transfer-dev@googlegroups.com
To unsubscribe from this group, send email to 
transfer-dev-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~--~~~~--~~--~--~---



[transfer-dev] Re: Have a One to Many relationship while still being able to query by the child foreign key

2009-03-06 Thread Paul Marcotte
heh, you mean I've used the phase it is what it is when I could have
shortened it to it's what it's? ;)

Paul

On Fri, Mar 6, 2009 at 8:53 AM, Peter Bell pb...@systemsforge.com wrote:

 In this case the apostrophe implies a contraction. It's == it is

 Brian was using its to imply possessiveness (go behind it's back == go
 behind the back of Transfer) which (from what I remember) doesn't use the
 apostrophe.

 Best Wishes,
 Peter


 On Mar 6, 2009, at 11:48 AM, Alan Livie wrote:

 @brian, you're correct but I still don't understand.

 If I shorten HAS NOT to HASN'T why is shortening IT IS to IT'S wrong?

 English is so confusing sometimes!

 Alan

 --
 *From:* Brian Kotek brian...@gmail.com
 *To:* transfer-dev@googlegroups.com
 *Sent:* Friday, March 6, 2009 4:15:13 PM
 *Subject:* [transfer-dev] Re: Have a One to Many relationship while still
 being able to query by the child foreign key

 ITS, not IT'S. I hate when I do that!

 On Fri, Mar 6, 2009 at 11:14 AM, Brian Kotek brian...@gmail.com wrote:

 I don't believe so. You'll need to remove it and either use TQL to do your
 list query, or write your own list query yourself outside of Transfer. Part
 of the point of Transfer is that you're dealing with Objects and their
 relationships, not tables and foreign keys. So trying to go behind it's
 back and do things like using foreign key columns directly is discouraged.











 



-- 
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 transfer-dev@googlegroups.com
To unsubscribe from this group, send email to 
transfer-dev-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~--~~~~--~~--~--~---



[transfer-dev] Re: Soft Delete?

2009-03-03 Thread Paul Marcotte
Rob,

I currently handle soft deletes (when required) using a delete() method on
my TO decorator.  Say I have a an e-commerce catalog with categories and
items and categories are recursive.  If a category has related items or
sub-categories, I want to soft delete.  Here's the method to handle that:

cffunction name=delete hint=Delete the current instance
returntype=void output=false access=public

cfscript
if (isParent() || hasItem()) {
// enact soft delete
setIsDeleted(true);
getCatalogDao().save(this);
} else {
getCatalogDao().delete(this);
}
/cfscript
/cffunction

In my service, I would then use something along the line of.

cffunction name=deleteCategory returntype=void output=false
access=public
cfargument name=CategoryId type=numeric required=true
cfscript
var category = getCategory(arguments.CategoryId);
category.delete();
/cfscript
/cffunction

I prefer this approach since it encapsulates the delete logic in the
business object.

HTH

Paul

On Tue, Mar 3, 2009 at 8:08 AM, Sir Rawlins 
robert.rawl...@thinkbluemedia.co.uk wrote:


 Hi John, thanks.

 Yeah the way I see its implementation working would be to keep the
 delete method invoketion the same, just change its implementation
 dependant on the XML configuration, this would allow some objects to
 be properly deleted and other only soft deleted likewise with
 cascading the deletes, sometimes I'll want a parent object to be soft
 deleted but its children are not audited so they can be properly
 removed :-)

 I kind of remember someone mentioning it was on the roadmap when I
 last asked a few months back, perhaps I'll play around with some
 patches and suggestions for Mark and see if I cant accelerate it a
 little.

 Rob

 On Mar 3, 4:01 pm, John Whish john.wh...@googlemail.com wrote:
  I believe that soft delete is already on the road map. I haven't tried
 it,
  but you should be able to overwrite the Transfer save method to do an
 update
  instead of a delete. So you code would still call the delete method.
 



-- 
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 transfer-dev@googlegroups.com
To unsubscribe from this group, send email to 
transfer-dev-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~--~~~~--~~--~--~---



[transfer-dev] Re: Decorator Dependancy Injection

2009-03-02 Thread Paul Marcotte
With Brian's blessing, I incorporated the BeanInjector into Metro and use it
within the Service and Transient Factories therein.  To enable injection of
transient objects into a TO Decorator, I create a setter in the Decorator
for the TransientFactory.  The TO then asks the factory for a transient when
required.  A validator instance for example.  Here's a snippet from the
metro core (base) decorator.

cffunction name=setTransientFactory access=public returntype=void
output=false
cfargument name=TransientFactory
type=metro.factory.TransientFactory required=true
cfset variables.TransientFactory = arguments.TransientFactory 
/cffunction

cffunction name=getTransientFactory access=public
returntype=metro.factory.TransientFactory output=false
cfreturn variables.TransientFactory /
/cffunction

cffunction name=setValidator access=public output=false
returntype=void hint=I set a reference to the generic Validator.
cfargument name=Validator type=any required=false hint=The
Validator.
cfif (not structkeyExists(arguments,Validator))
cfset arguments.Validator =
getTransientFactory().create(Validator)
/cfif
cfset variables.properties.Validator = arguments.Validator
/cffunction

cffunction name=getValidator access=public output=false
returntype=any hint=I return the generic Validator.
cfif (not structkeyExists(variables.properties,Validator))
cfset setValidator()
/cfif
cfreturn variables.properties.Validator
/cffunction

HTH

On Mon, Mar 2, 2009 at 9:58 AM, Brian Kotek brian...@gmail.com wrote:

 The Bean Injector isn't meant to be used directly with beans managed by
 ColdSpring. It's meant to be used with objects created by an external
 factory (I initially created it to wire things into Transfer Objects). But
 yes, you want to create your own factory that will create the object,
 autowire it using the BeanInjector, and then return it. It does indeed cache
 the dependencies, which means you'll get the same ColdSpring beans wired
 into each instance. Otherwise it would have to resolve the dependencies for
 every instance, which would be a big performance hit.

 So to be clear, it's meant to wire Singleton beans into transient objects.
 It isn't meant to wire multiple transients together, that's getting into ORM
 territory.


 On Mon, Mar 2, 2009 at 11:19 AM, Ezra Parker ezrapar...@gmail.com wrote:


 On Feb 28, 10:42 am, John K. rayray5...@gmail.com wrote:
  The problem I had was that when I created my bean in CS and
  set it to singleton = false and then used Brian's Injector, it seemed
  to inject the same bean.

 I believe that what was happening here is that the BeanInjector was
 caching the first instance of your non-singleton object upon the first
 injection, and then using this cached instance for subsequent
 injections. Despite the fact that the object was defined in CS as a
 non-singleton, the BeanInjector would re-use the same instance for all
 injections, thus resulting in the behavior you noted.

 --
 Ezra Parker



 



-- 
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 transfer-dev@googlegroups.com
To unsubscribe from this group, send email to 
transfer-dev-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~--~~~~--~~--~--~---



[transfer-dev] Re: Saving the Secondary Key on a ManyToOne value?

2009-02-19 Thread Paul Marcotte
Matthew,

Transfer does not generate methods to create compositions based on your FK
names.  Therefore, if you wish to use that convention, you must use a
decorator and and behaviour to your BO.  You have two choices.

1.

objGallery = transfer.getTransfer().new(Gallery);
objProduct = 
transfer.getTransfer().get(Product,form.Id);objGallery.setTestField(cat);
objGallery.setProduct(objProduct);
transfer.getTransfer().save(objGallery);

2.

Add a method to your Gallery Decorator

cffunction name=setProductId returntype=void output=false
access=public
cfargument name=ProductId required=yes type=numeric /
cfset var product =
getTransfer().get(Product,arguments.ProductId)
cfset getTransferObject().setProduct(product) /
/cffunction

If you go with option 2, I'd recommend a get method that returns the
productId.

Why does it work this way?  Tranfer ORM is an object relational mapper, so
one should make every effort to augment their thinking for table relations
to object relations.  It's not easy.  I had a difficult time making the
adjustment.

Best of luck!

Paul


On Thu, Feb 19, 2009 at 4:31 AM, John Whish john.wh...@googlemail.comwrote:

 I find the getMemento method is really useful for debugging as you can see
 what is persisted. Just do cfdump var=#objGallery.getMemento()# /
 BTW: getMemento is ONLY for debugging :)

 



-- 
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 transfer-dev@googlegroups.com
To unsubscribe from this group, send email to 
transfer-dev-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~--~~~~--~~--~--~---



[transfer-dev] Re: Saving the Secondary Key on a ManyToOne value?

2009-02-19 Thread Paul Marcotte
Thanks for clarifying that for me, Ezra.  :)

Paul

On Thu, Feb 19, 2009 at 3:49 PM, Matthew matthewbchamb...@gmail.com wrote:


 @Ezra: that makes complete sense. I solved it this morning as per my
 last reply. Thanks for confirming.

 Cheers
 Matthew

 On Feb 20, 10:31 am, Ezra Parker ezrapar...@gmail.com wrote:
  Hi Matthew,
 
  I think you misunderstood Paul's reply. You do not have to create a
  decorator to use the first approach he listed:
 
   objGallery = transfer.getTransfer().new(Gallery);
   objProduct = transfer.getTransfer().get(Product,form.Id);
   objGallery.setTestField(cat);
   objGallery.setProduct(objProduct);
   transfer.getTransfer().save(objGallery);
 
  Transfer will generate the setProduct() method for the Product
  ManyToOne composition, and you can just call it on the Gallery object.
  You do need to pass it a Product object as its argument, however, not
  the ProductId key. If you instead wanted to use a setProductId()
  method, then *that* would require that you use a decorator for your
  Gallery object so you could add the method yourself.
 
  Does that make sense?
 
  --
  Ezra Parker
 



-- 
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 transfer-dev@googlegroups.com
To unsubscribe from this group, send email to 
transfer-dev-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~--~~~~--~~--~--~---



[transfer-dev] Re: Global Decorators

2008-12-04 Thread Paul Marcotte
Absolutely.  I have a base Decorator that my concrete decorators extend.
The base decorator itself extends transfer.com.TransferDecorator.

Paul

On Thu, Dec 4, 2008 at 10:51 AM, spiraldev [EMAIL PROTECTED] wrote:


 This may be a dump question but is there a way to create a global
 decorator? And have another decorator? basically I have a couple of
 functions that I want all of my transfer beans to have but I don't
 want to create a decorator for every transfer object.
 



-- 
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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---



[transfer-dev] Re: Global Decorators

2008-12-04 Thread Paul Marcotte
You could  use decorator=path.to.baseDecorator. :)

Paul

On Thu, Dec 4, 2008 at 11:02 AM, Matt Graf [EMAIL PROTECTED] wrote:


 Yes that is what I have now. But what I want is the ability to have a
 global decorator without creating a decorator for my transfer object.

 Example I have a widget that does not need a decorator other then what
 is in the base decorator.

 On Thu, Dec 4, 2008 at 10:58 AM, Matt Quackenbush [EMAIL PROTECTED]
 wrote:
  Create a BaseTransferObjectDecorator that extends
  transfer.com.TransferDecorator.  Then have your decorator extend
  BaseTransferObjectDecorator.
 
  HTH
 
 
  
 

 



-- 
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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---



[transfer-dev] Re: Global Decorators

2008-12-04 Thread Paul Marcotte
That's some fancy voodoo, Elliot (and Bob).   Event observers are
powerful...if only they made a great Americano... ;)

Paul

On Thu, Dec 4, 2008 at 11:59 AM, Elliott Sprehn [EMAIL PROTECTED] wrote:


 On Dec 4, 2:20 pm, Matt Quackenbush [EMAIL PROTECTED] wrote:
  On Thu, Dec 4, 2008 at 1:19 PM, Matt Graf wrote:
 
   I don't think I am explaining myself very well lets see if I can
   explain it a little better
 
   Here is an example of where I tell transfer to use my decorator
   object name=widget_one table=widget_one
   decorator=model.decorators.widget_one
 
   now what I want is for transfer to use my base decorator without
   telling transfer to do so.
 
   is that possible?
 
  No.

 I'm going to have to cry foul on this. It *is* possible, but it
 requires some creativity.

 1. Create your special decorator object.
 2. Create a single instance of this object and add it as a listener
 for the AfterNewTransferEvent.
 3. Implement the actionAfterNewTransferEvent() method such that it
 mixes the two components together and does setup.

 AutoDecorator.cfc:

 !---+
Mix the two components together. Only mixes the public stuff, so if
 you need private methods or
variables you'll need to inject another method and use that.
 ---
 cffunction name=actionAfterNewTransferEvent access=public
 returntype=void output=false
cfargument name=event type=transfer.com.events.TransferEvent
 required=true

cfset var object = arguments.event.getTransferObject()

cfset object.mixin = mixin
cfset object.mixin(variables)
!--- Maybe call some special method like setup() here to allow the
 special decorator to do setup ---
 /cffunction

 cffunction name=mixin access=public returntype=void
 output=false
cfargument name=componentVariables type=any required=true

cfset structAppend(this,componentVariables.this,false)
cfset structAppend(variables,componentVariables,false)
 /cffunction

 In general I'm a big advocate of very dynamic solutions, but this
 seems rather extreme with a high cost in terms of maintainability
 later. So, while this does work, I'd argue that it'd be better to just
 use decorator=BaseDecorator on every object/ in your transfer.xml
 instead of this much black magic.

 



-- 
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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---



[transfer-dev] Re: Cache syncing between applications on one server

2008-11-28 Thread Paul Marcotte
Stephen,

Out of curiosity, are both applications being initialized with the same
transfer.xml and use the same definitions path?  If so, then targeting the
server scope for cache is the way to go.  The only caveat is that your
application init code will then have to clear the cache out of server scope
to ensure a clean init.

Cheers,

Paul

On Fri, Nov 28, 2008 at 9:27 AM, Stephen Moretti
[EMAIL PROTECTED]wrote:



 2008/11/28 Bob Silverberg [EMAIL PROTECTED]


 Or you could keep the transfer instances as is, and specify SERVER as
 the caching scope for each.  Another way of accomplishing the same
 thing as suggested by Chris.  I'm not sure what the trade-offs would
 be between those two approaches.


 Yeah - I was kinda trying to avoid using the server scope. I've never been
 terribly happy with sticking stuff in the server scope, but perhaps this is
 the way to go with this.

 Thanks guys.

 Stephen


 



-- 
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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---



[transfer-dev] Re: Nullable Values - still don't get it

2008-11-28 Thread Paul Marcotte
Hi Jared,

You can call nullifyDates() in the configure method of your decorator.
Transfer will fire the configure method before returning the new object.

Paul

On Fri, Nov 28, 2008 at 1:28 PM, Jared [EMAIL PROTECTED] wrote:


 I read through this thread, but I still don't understand how to handle
 the problem where date properties of a transfer object default to Now
 ().  I find that weird.  Why don't they default to the null value for
 dates?  Setting them to Now() is a bit like defaulting string values
 to hello there or defaulting numeric values to 17.  I can't write a
 configure method to handle this, since I don't want to always set the
 date values to null (or whatever stands in for null, since CF doesn't
 have null (which is annoying)).  I only want to do so in response to
 Transfer.new().  The only thing I can think of is to write a method in
 my decorator called nullifyDates() that goes through each date and
 does a setMyDatePropertyNull().  Then, whenever I do a new() for this
 type of object I would, on the next line, do a myObj.nullifyDates() to
 fix the weirdness of dates defaulting to Now().  Seems like a bit of a
 hack.  Is that the only way?

 That said, transfer is great!  Long live transfer.  Send Mark money.

 



-- 
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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---



[transfer-dev] Re: Nullable Values - still don't get it

2008-11-28 Thread Paul Marcotte
Ooops, I misread your post.  You could use an afterNew Observer instead.
But I'm wondering if configure is fired even on get()?

***heads to docs...

Paul

On Fri, Nov 28, 2008 at 1:59 PM, Paul Marcotte [EMAIL PROTECTED] wrote:

 Hi Jared,

 You can call nullifyDates() in the configure method of your decorator.
 Transfer will fire the configure method before returning the new object.

 Paul


 On Fri, Nov 28, 2008 at 1:28 PM, Jared [EMAIL PROTECTED] wrote:


 I read through this thread, but I still don't understand how to handle
 the problem where date properties of a transfer object default to Now
 ().  I find that weird.  Why don't they default to the null value for
 dates?  Setting them to Now() is a bit like defaulting string values
 to hello there or defaulting numeric values to 17.  I can't write a
 configure method to handle this, since I don't want to always set the
 date values to null (or whatever stands in for null, since CF doesn't
 have null (which is annoying)).  I only want to do so in response to
 Transfer.new().  The only thing I can think of is to write a method in
 my decorator called nullifyDates() that goes through each date and
 does a setMyDatePropertyNull().  Then, whenever I do a new() for this
 type of object I would, on the next line, do a myObj.nullifyDates() to
 fix the weirdness of dates defaulting to Now().  Seems like a bit of a
 hack.  Is that the only way?

 That said, transfer is great!  Long live transfer.  Send Mark money.

 



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




-- 
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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---



[transfer-dev] Re: cross-database join question

2008-11-24 Thread Paul Marcotte
Jared, you left out the naked part on your fourth point. ;)

Paul

On Mon, Nov 24, 2008 at 7:35 PM, Jared Rypka-Hauer
[EMAIL PROTECTED]wrote:


 I know with SQL Server you can use dot notation to access objects in
 other databases: dbName.schemaName.tableName. Schema name, owner
 name, user name, whatever... the default is dbo. Dunno about other
 platforms, might just be dbName.tableName on MySQL.

 So if you've pointed a datasource at, say, the Employee database and
 need to point Transfer at a table in the CompanyAssets table you
 should be able to use object name=DesktopComputer
 table=CompanyAssets.dbo.DesktopComputers /.

 Caveats:
 The databases have to be on the same physical server (or accessible
 using this dot notation from query analyzer anyway)
 The user used for the DSN has to have access to the second DB
 You have to have the DB.owner.tablename path exact perfect and all 3
 present
 You have to walk 3 counter-clockwise circules around a mature
 unicorn, under a full moon, to get it to work.

 You should test it and see if it works! :)

 J

 PS - I made the 4th one up. :P

 On Nov 24, 2008, at 6:45 PM, Mark Mandel wrote:

 
  When you say 'multiple dsns', you can't use multiple cf datasources...
  but you can specify in your mapping xml
 
  object table=owner.tablefoo /
 
  From there, it should just work as normal, assuming your database can
  support it.
 
  Is that what you were asking? ...

 



-- 
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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---



[transfer-dev] Re: function is not of type transfer.com.TransferObject

2008-11-21 Thread Paul Marcotte
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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---



[transfer-dev] Re: Reorganising SVN

2008-11-21 Thread Paul Marcotte
Mark, thanks for the heads up.

Time to fix my frameworks ant task... ;-)

Paul

On Thu, Nov 20, 2008 at 8:38 PM, Mark Mandel [EMAIL PROTECTED] wrote:


 Just a note to let you know that I'm reorganising SVN so it is:

 /project1
  /tags
  /trunk
  /branches
 /project2
  /tags
  /trunk
  /branches

 Rather than

 /tags
 /trunk
  /project1
  /project2
 /branches

 Which has gotten to the point that its driving me nuts (and I have
 some new stuff to add)

 So if you SVN details break, this is why.

 Mark

 --
 E: [EMAIL PROTECTED]
 W: www.compoundtheory.com

 



-- 
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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---



[transfer-dev] Re: TransferSync HOWTO

2008-10-16 Thread Paul Marcotte
Thanks for posting this, Brian.  It's sure to be an invaluable resource!

Paul

On Thu, Oct 16, 2008 at 9:53 AM, Brian G [EMAIL PROTECTED] wrote:


 I recently put Tom de Manincor's TransferSync into production in my
 two node cluster and wrote up my process:


 http://www.ghidinelli.com/2008/10/16/synchronizing-transfer-orm-in-a-model-gluecoldspring-cluster-with-transfersync

 I have run into ActiveMQ timing out in a few cases and I have some
 hints on how to stop it.  I've load tested this setup and it's worked
 quite well.  Thanks again to Tom for the legwork, it made my life much
 easier!


 Brian

 



-- 
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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---



[transfer-dev] Re: Self-Referencing onetomany relationship breaking on save

2008-10-15 Thread Paul Marcotte
Hi John,

I played with this from a onetomany prespective and quickly learned that I
had an object explosion on my hands since each object would maintain a
reference to it's parent and a collection of child objects.  Instead, I
modeled it with simplicity and performance in mind.  With manytoone, the
child object will have a hasParent() method and I can get the full path to
the top level parent object using recursion.  Here's an example method for
retrieving a path to the root from any self-referencing (transfer) object
with manytoone relationship (assuming the object has a getName() method).

cffunction name=getTreePath access=public output=false
returntype=string
cfargument name=obj type=any required=true
cfargument name=path type=string required=false default=
cfset var treePath = /  arguments.obj.getName() 
arguments.path
cfif arguments.obj.hasParent()
cfset treePath =
getTreePath(obj=arguments.obj.getParent(),path=treePath)
/cfif
cfreturn treePath
/cffunction

I use something similar for a home grown cms that has parent/child pages.
Using mod_rewrite I create SES friendly urls based on the page names. So,
you could very easily build a breadcrumb trail in this manner, or with a
little sql, create a nested nav of categories.  Here's a link to a page on
the site I mentioned above.

http://www.slcc.ca/about-us/tale-of-two-nations/protocol-agreement

Cheers,

Paul


On Wed, Oct 15, 2008 at 10:19 AM, John Barlow [EMAIL PROTECTED] wrote:


 I see how that could work, but wouldn't that also remove all of the
 handy child functions that the onetomany relationship would give you?

 On Oct 15, 12:31 pm, Paul Marcotte [EMAIL PROTECTED] wrote:
  Hi John,
 
  I would suggest using a manytoone for nesting categories. The object
  definition for your category would include
 
  manytoone name=Parent lazy=true
  link to=Category column=category_parent_id/
  /manytoone
 
  Note that if you use a table column for an object relationship, you
 cannot
  have a property referencing the same column.  I'm guessing that is why
 your
  sql has two references to category_parent_id.
 
  Cheers,
 
  Paul
 
 
 
  On Wed, Oct 15, 2008 at 7:32 AM, John Barlow [EMAIL PROTECTED] wrote:
 
   Greetings all,
 
   I've been racking my brain for about two days to try to figure this
   out.  I have a category table, consisting of, among other things, a
   category_id and a category_parent_id.  The idea is that categories can
   be sub categories of others (hence the category_parent_id) and have a
   null parent if they are the root node.
 
   I set up a onetomany relationship linking the category_id to the
   parent_id with lazy loading and everything was working beautifully for
   reading.  The problem cropped up when I tried to save a record.
 
   The error that came back was a SQL error, stating category_parent_id
   appears more than once in the result column list.  From what I can
   find, this error occurs if you have two tables and have the
   relationship defined on both tables.  The solution there is to remove
   a relationship definition from one of the tables and all is well.
 
   Since this is referencing itself, it is inherently getting both sides
   of the definition defined, which I think is what is causing this to
   break.  I checked the SQL, and indeed it is taking on an extra
   category_parent_id to the end of the insert statement.
 
   I'm not sure if this is a Transfer bug or if I'm trying to use it in a
   way it wasn't meant to, but having a self-referencing table like this
   seems like a reasonable thing one would want to be able to model.  For
   the record, I did get around it by using a link table that has two
   columns that point to the category_id field in the category table and
   a Many to Many relationship.  Ideally, I'd like to not use an extra
   table to do this.
 
   I just wanted to bring this to the masses because I couldn't find
   anything on this and felt it may have been overlooked.  What I WAS
   able to find was in reference to hibernate.
 
   System specs:
   -Transfer 1.0
   -CF7
   -MSSQL 2005
   -XP
 
  --
  Paul Marcotte
  Fancy Bread - in the heart or in the head?http://www.fancybread.com

 



-- 
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 transfer-dev@googlegroups.com
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
-~--~~~~--~~--~--~---