Release Notes
4.* Series
4.0.1
- Changed the way models are turned into JSON. Previously related collections would get turned into JSON objects with properties named "_item0", "_item1", etc. This was due to how collections are handled internally. Now collections where the first item has a key starting with an underscore (such as "_item0") will be considered to be unassociative and turned into a JSON array instead.
3.* Series
- The 3.x releases added implementations for the concepts of "blank" models and forced loading. Also various bug fixes related to LoadMaps.
2.* Series
2.6.6
- Fixed an issue with on-model loadMapping being applied when fetching an item by ID while the model_constraints were not. Now fetch by ID will not be affected by loadMaps or constraints.
2.6.5
- When passing data to child loadMapped relationships, a special rule for columns named "id" would cause problems. This special rule was excepted when loadMapping.
- Modified the Map and Filter methods in Collections so that data can be passed in to the closure.
2.6.4
- Added changes to prevent onModel loadMaps from unintentionally loading related models when saving the parent.
2.6.3
- Added ability to define a LoadMap as part of a model. Using Model constraints in combination with an on-model LoadMap can result in the same functionality as a custom query and manual LoadMap for models where you always want to fetch additional info.
See: On Model LoadMaps
2.6.2
- Changed the way data is passed into the new Closures for query customization. Arguments are no longer lumped into one array. See below:
Previous Format:
// Pretend we got these vars from somewhere...
$currentPage = 0;
$itemsPerPage = 20;
// Let's fetch a paginated view of the articles this user has written:
$currentPageArticles = $user->articles(function($query, $args) {
return $query->offset($args[0] * $args[1])
->limit($args[1]);
}, [$currentPage, $itemsPerPage]);
New Format:
// Pretend we got these vars from somewhere...
$currentPage = 0;
$itemsPerPage = 20;
// Let's fetch a paginated view of the articles this user has written:
$currentPageArticles = $user->articles(function($query, $page, $itemsPerPage) {
return $query->offset($page * $itemsPerPage)
->limit($itemsPerPage);
}, [$currentPage, $itemsPerPage]);
2.6.1
- Can now do hand-written queries using a Query Builder object
- Can pass a custom function to a Repository's findOne and findAll methods
(is an easier way to customize the query than what was available before) - Can pass a custom function to a model's relationships
(allowing customization that was previously impossible) - Can dynamically map fields from a database to attributes on a model
(previously this was only possible through model definition) - Can specify relationships you want loaded on models fetched
(useful for working with JSON returning APIs) - You can now efficiently load some model relationships to reduce DB load
(using a combination of custom queries, field mapping, and load specifications) - Can specify a custom onLoad function
- Will now get Exceptions when calling non-existant functions on a Collection