Extending a Base Decorator with Transfer

So you have a few methods you want to include in every Transfer Object, and you don’t want mess with mix-ins, and copy/paste isn’t an option. You want to extend it but its already extending the transfer.com.TransferDecorator. So what can you do?

1. Create your Base Decorator CFC, and extend the transfer.com.TransferDecorator.












2. Now change the ‘extends’ in the object decorator to extend the Base Decorator CFC





Now you’ll have the baseDecorator and the accountDecorator methods available to you from your TransferObject.

Wait…What if you only need to extend the baseDecorator to your TransferObject and don’t forsee a need for an accountDecorator? Dont create an empty accountDecorator just to extend the baseDecorator.

Change the value of the decorator attriute in the Transfer Config XML to the path of your baseDecorator.


Leave a Reply

Your email address will not be published. Required fields are marked *