Official release of TDBM 4
Today, we are very proud to announce the release of TDBM 4, the ORM that comes with the Mouf framework.
Want a preview? Take a look at those slides:
http://moufmouf.github.io/tdbm4-slides/#/
or head directly to the documentation
Major changes
- TDBM 4 is a complete rewrite from TDBM 3, with a lot of energy put in better organizing the code and better unit testing
- The global philosophy of TDBM stays the same: your database model is meaningful and TDBM will do it's best to generate PHP objects from your database model. It is therefore taking a completely different direction than what Doctrine ORM does.
- TDBM does what it can to avoid the classical traps of the Active record design pattern. TDBM is well suited for simple to moderatly complex applications.
- Beans can now be instantiated directly (no need to use the
TDBMService
for this)
- Beans can now be instantiated directly (no need to use the
- TDBM 4 is relying on Doctrine DBAL for database access
- TDBM 4 is built on top of MagicQuery. It can automatically discard unused parameters in a SQL query. This is very useful to seamlessly write filters.
- TDBM 4 will automatically generate query methods based on the indexes in your database
- As always with TDBM, a lot of energy has been put in simplifying the query process. TDBM will automatically detect joins between tables
- TDBM 4 can automatically detect pivot tables and will generate many-to-many getters and setters accordingly.
- Generated beans now support the inheritance between tables (using primary keys as a foreign key technique)
- Results are no more simple arrays. They implement the beberlei/porpaginas library: you can now get offset/limit and the total count from the result object.
- Beans do not have a
save
method any more. You need to use the DAOsave
method instead.
Minor changes
- Improved support for singularizing names (countries => CountryBean instead of countries => CountrieBean, thanks to ICanBoogie/Inflector)
- Primary keys can now be updated
- In cursor more, queries can now be looped over several time (this will trigger the query several times in database)
- Base DAOs are now named
TableNameBaseDao
instead ofTableNameDaoBase
(more coherent with bean naming) - Generated names for methods in beans has changed:
- There is no longer getter and setters for "ID" columns that are foreign keys to other columns.
- Foreign key getters and setters are now base on the column name rather than the table name. If you have a table "user" with a column "birth_country_id" pointing to a table "country", previously, TDBM was generating "getCountry/setCountry" methods along a "getCountryByBirthCountryId/setCountryByBirthCountryId" method. Now, it will only generate a "getBirthCountry/setBirthCountry" pair of methods.
- New
findObjectOrFail
method that performs afindObject
and throws an exception if no result is found.
What's next?
In the next version (TDBM 4.1), we plan to:
- Make TDBM easily usable out of Mouf
- This means adding a CLI tool to generate bean and DAOs
- Adding a service provider to easily create the TDBM service
- Migrate the library to PHP 7 only: support from older PHP versions will be dropped
Tags :
- david's blog
- Log in to post comments
What’s new on Mouf :
- TDBM 5.0 is released 09/11/2017
- Quickstarting a Mouf appl... 15/06/2017
- Building beautiful datagr... 05/10/2016
- Official release of TDBM... 14/06/2016
- Announcing Mouf 2.1 first... 01/03/2016
- Mouf + Magento + PSR-7 =... 30/06/2015
- Standardizing the way we... 10/06/2015
- Container interoperabilit... 09/06/2015
- Container-interop + PSR7... 01/06/2015
- New in Mouf: a console! 19/05/2015