> For the complete documentation index, see [llms.txt](https://coldbox-orm.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://coldbox-orm.ortusbooks.com/intro/release-history/whats-new-with-4.6.0.md).

# What's New With 4.6.0

CBOrm 4.6.0 brings important bug fixes for multi-datasource support and introduces powerful new functional helpers for ActiveEntity.

## Fixed

### Multi-Datasource Event Handling

* [**CBORM-37**](https://ortussolutions.atlassian.net/browse/CBORM-37): Fixed critical issue in the `PostLoad` event handler that affected entities using non-default datasources. Multi-datasource applications now properly fire post-load events.

### Platform Support Cleanup

* **Deprecated Engine Removal**: Removed support for deprecated CFML engine versions that have reached end-of-life

## Added

### BoxLang Testing

* **BoxLang Auto-Testing**: Implemented automated test suite execution for BoxLang runtime

### ActiveEntity Functional Helpers

Several new flow control methods have been added to `ActiveEntity` to enable functional, chainable entity operations:

#### `peek( closure )`

Allows peeking into the building process without breaking the chain:

```javascript
user = new User()
    .setFirstName("Luis")
    .peek(function(entity){
        // Inspect or log the entity during building
        writeDump(entity.getMemento());
    })
    .setLastName("Majano")
    .save();
```

#### `when( boolean, successClosure, failureClosure )`

Conditionally execute logic without if statements:

```javascript
user = new User()
    .setEmail(rc.email)
    .when(
        rc.isAdmin,
        function(entity){ entity.setRole("administrator"); },
        function(entity){ entity.setRole("user"); }
    )
    .save();
```

#### `unless( boolean, successClosure, failureClosure )`

The opposite of `when()` - execute when condition is false:

```javascript
user = new User()
    .setActive(true)
    .unless(
        user.hasVerifiedEmail(),
        function(entity){ entity.setActive(false); }
    )
    .save();
```

#### `throwIf( boolean, type, [message], [detail] )`

Throw an exception if a condition is met:

```javascript
user = new User()
    .setAge(rc.age)
    .throwIf(
        user.getAge() < 18,
        "ValidationException",
        "User must be 18 or older"
    )
    .save();
```

#### `throwUnless( boolean, type, [message], [detail] )`

Throw an exception unless a condition is met:

```javascript
user = new User()
    .setEmail(rc.email)
    .throwUnless(
        isValid("email", user.getEmail()),
        "ValidationException",
        "Invalid email address"
    )
    .save();
```

{% hint style="success" %}
These functional helpers enable cleaner, more expressive entity building without breaking the fluent chain or requiring intermediate variables.
{% endhint %}

## Release Date

February 19, 2025


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://coldbox-orm.ortusbooks.com/intro/release-history/whats-new-with-4.6.0.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
