Every six months a new version of RedBeanPHP is released. Here you find the changes in each revision starting from version 4.0.
Changes in version 4.1 (October 2014)
- R::findOne() adds LIMIT 1 to query if no LIMIT clause is found
- R::tagged() and R::taggedAll() now accept SQL for pagination
- Improved performance parent bean saving
- Improved method signature of dup: R::duplicate
- Custom beans through REDBEAN_OODBBEAN_CLASS constant
- Allow some JOINS in with/withCondition for own-lists.
- Improved support for UUIDs/GUIDs. This feature has been backported to 4.0.5 as well.
- Column functions: bind a function to a column
- Improve setup time by providing direct PDO setter (use with care!)
- Add a method to test the database connection
- Add new debug mode with query parameters filled in
- Add new debug function to inspect beans and arrays of beans
- Treat beans in own-list as shared list: aggregated list
- Split OODB in two repositories: frozen and fluid (no API changes)
- Regular maintenance & clean up
- Additional tests
Backward incompatible changes
RedBeanPHP 4.1 should be fully backward compatible. However, there is one change that may affect some code relying on undefined behaviour. In 4.1 a bean will only be saved if it has been changed through the setter (meta: changed). If a bean is tainted by accessing its lists it will perform all save operations but not fire the actual SQL query if no changes have been made to the bean itself. If for some reason you relied on the redundant SQL query you might want to set the 'changed' meta property manually. You can also implement this system-wide by extending the SimpleModel.
Changes in version 4.0 (April 2014)
- PHP native namespaces
- Exclusive own-list
- Tree Traversal function
- 10% performance improvement for basic CRUD operations
- Performance improvements for bean conversion
- Improved Array Access interface (you can now use arrays instead of beans all the time)
- Improved handling of unique constraints
- Added EID() function to easily insert ENUM bean IDs in queries
- Constraints now also use ON UPDATE CASCADE
- Dispense works more consistently now
- Fixed an issue with type of return ID value in Postgres driver
- Fixed possible cache collision issue
- Performance improvements for fluid mode
- Big clean-up: removed Cooker/Graph (use dispense), Preloader (plugin), BeanCan Server (plugin)
- CUBRID driver still available but as plugin
Version 4 FAQ
This is a list of questions and answers regarding the 4.0 release.
Why has the Preloader been removed?
When I wrote the preloader,
the original purpose was to prevent for-each loops to fire queries when retrieving the parent of a bean.
Later I added the writer cache which could take care of this but was turned off by default.
In RedBeanPHP the writer cache is turned on by default solving the original problem.
Meanwhile people requested all kinds of new features for the Preloader like support for
loading own-lists, shared-lists and even aliases and SQL snippets.
It even got its own syntax. I decided to remove the preloader because
I believe simple SQL is better suited to query large amounts of records all at once for overviews and reports.
This functionality is still available as a plugin.
Why has graph() been removed from core?
R::graph() was a powerful feature to load and updates beans directly from forms. However
the graph() function assumed you were also using FUSE for validation. Otherwise the function
could lead to serious architectural and security defects. I fixed this in version 3, but then
it became less powerful, so in version 4 I decided to remove it entirely from the core.
This functionality is still available as a plugin.
Also note that the new R::dispense() method works much like the old graph() method.
Why is R::associate gone?
The R::associate() method (as well as unassociate etc...) is a relic from the past. In the earliest versions of RedBeanPHP I believed you only needed many-to-many relations. Although this was true, performance became a real bottleneck. I had to find a way to apply the on-the-fly philosophy to N-1 relations as well, this resulted in the introduction of own-lists and shared-lists. Since then, I kept the old associate() method for backward compatibility reasons. In version 4 however I decided to finally clean up.
Why are the BeanCan Servers gone?
They blurred the distinction between plugin and core.
Also, the RedBeanPHP Adaptive branch is going more in the direction of a framework which
is a better place for BeanCan as well. RedBeanPHP 4 returns to the core of the library:
on-the-fly ORM. Another reason is that it turns out it is pretty much impossible to
prescribe the interface of a JSON or REST API.
This functionality is still available as a plugin
Why does RedBeanPHP 4KS not support composer?
As of version 4 KS I revoke all support for Composer. There are several reasons for this:
- I don't want newcomers to learn about Composer first. The PHAR/PHP distribution is easy to use and does not require any prior knowledge about other systems
- I question the usefulness of systems like Composer/Gems/NPM - I think this should be handled manually
- Supporting Composer well, requires me to change the layout of my library (putting everything in a lib folder) which is ridiculous
- I don't want to make RedBeanPHP depending on Composer. Many libraries I use are completely messed up because their authors assume everyone is using Composer
- Packagist uses Github as a distribution tool - which is a mistake. Git is version control system and not meant to be used for this.
New in RedBeanPHP 3.5.7
This is a minor maintenance update.
- Fixed issue in QueryWriter cache (3.5.7b)
- Improved stacktrace in SQL exception
- Improved performance of convertToBeans() method
- Allow duplication of trees
- With now also works with joins