Welcome to ColdBox 3.1.0 NEAR-JAMES 4:8, our latest ColdBox release. This release really brings home all the features we launched in 3.0.0, from rendering capabilities, performance, to WireBox enhancements and a fully sported AOP library. All of our major libraries have been updated with fixes and launches of their own:
- LogBox 1.6.1
- WireBox 1.2.0
- CacheBox 1.2.1
So let's check out this release according to our milestone tickets and also where you can find this release:
Fixes
- 1194 json fixes for cf8 and above when dealing with real object serialization
- 1198 update ses module route removal to remove all module routing when reloading
- 1199 Variable LOG is undefined on transaction aspect as log is not mixed in exception
- 1200 ses package resolver was not resolving module packages directly but looking at parent first, it should look at modules only if in a module routing call already, so modules now have cool new package resolving
- 1201 orm services using tx.wasCommitted() was not correctly reporting the commit status of the session, so removed for basic transaction rollbacks
- 1206 compatibility for renderView() and setView() for the 'view' argument instead of 'name' argument, but 'name' still works
- 1209 onInvalidEvent was not consistent for modules and too tedious to override, so made it simpler. 3.1.0 so it works for any invalid event anywhere. Also, you can set the even to exist in the parent, package, module or anywhere you like now
- 1245 Renderview cache/noCache conflicts for viewlets resolved
Enhancements
- ORM Services get a new property: useTransactions() which tells the base or virtual service to use hibernate safe transactions around methods that do persistence: save,saveAll,delete,deleteAll,deleteBy,deleteWhere,etc
- Application.cfc if using inheritance can be completely empty now
- Updated the mail payload when doing mail to return itself so you can do concatenations of methods
- Updated the request context so it returns itself so you can do concatenations of methods on almost all non-returning methods
- All event handler methods now receive not only the event object but the rc and prc references so it makes it super easy to have acces to all three objects.
function index(event,rc,prc)
- New Mail Service helper methods:
- setHTML() Convenience method to set a multi-part HTML portion
- setText() Convenience method to set a multi-part TEXT portion
- addAttachments(files) Convenience method to add a file attachment by sending the file location or an array/list of locations
- setSendReceipt(email) Convenience method to set the right headers for delivery confirmation
- setReadReceipt(email) Convenience method to set the right headers for read confirmation
- Mail service now can be configured with a mail protocol object that determines how mail is sent. A new abstract base has been provided to build your own protocols also: coldbox.system.core.mail.AbstractProtocol. So what does this do? By default the mail service sends email via our CFMailProtocol which does so via the cfmail tag. However, we also have included two more:
- FileProtocol : Sends an email to a directory in the file system
- PostmarkProtocol: Sends an email via the PostMark web service application
- So apart from those available protocols you can build your own. So how do we configure it? Via the configuration settings in your application:
The protocol key can be any valid instantiation path that leverages our abstract protocol family.
mailSettings = {
server="",
username="",
password="",
protocol="coldbox.system.core.mail.protocols.FileProtocol"
};
- You can have default values for ANY of the cfmail tag attributes via the mailSettings configuration element. We saw from above a new key: protocol, but you can add ANY or CUSTOM keys to the structure and they will be added to the mail payload object for you. This is a great way to define default mailing attributes or custom ones.
- We also added two new methods to our super type base class so all your handlers, plugins and interceptors can now do emailing rather easily:
- getMailService() To retrieve the Mail Service plugin
- getNewMail(arguments) To get you a new mail payload object with any of the passed in arguments (matches the cfmail attributes) and prepares it for you to send via the service.
- Render data method gets a new argument: location so you can easily add a location header when building RESTful web services:
Rendering Enhancements
- Cached resolution of view locations and their helpers which has improved rendering times considerably
- New HTML helper attached to all views and layouts as a new variable in the variables scope: html -> HTMLHelper plugin. That will help you build HTML snippets very easily, from HTML 5 video, to entity binding textareas, you name it.
Rendering With Local Variables
Passing local variables to layouts and views: renderView(args), renderLayout(args) now get the args argument which can be a structure of data that will be specifically passed to views/layouts for rendering ONLY there. This gives you great DRYness (yes that is a word) when building new and edit forms or views as you can pass distinct arguments to distinguish them and keep structure intact.
Easy Nested Layouts/Views
renderLayout(layout,view) no longer requires you add a arguments.view to the renderview content holder. It is smart enough now to detect it and do it for you. This allows you to nest layouts with views a la carte for renderings very easily. You can reuse layouts for anything now.
Rendering Collections
You now have two new arguments in the renderView() method:
- collection : A data collection that can be a query or an array of objects, structs or whatever
- collectionAs : The name of the variable in the variables scope that will hold the collection pivot.
Once you call renderView() with a collection, the renderer will render the view once for each member in the collection. The views have access to the collection via arguments.collection or the member currently iterating. The name of the member being iterated as is by convention the same name as the view.
Add Your Comment