Hey #OpenSource Community and lovers of #PHP,
Thousands of engineers have asked for these changes and we are super excited to announce the much anticipated release of Cycle 2.0, the open source, PHP DataMapper, ORM and Data Modelling engine designed to safely work in classic and daemonized PHP applications (like RoadRunner which we hope you have checked out or are using). Cycle’s ORM provides flexible configuration options to model datasets, a powerful query builder and supports dynamic mapping schema. The engine can work with plain PHP objects, support annotation declarations, as well as proxies via extensions. Currently, Cycle reached 100K downloads and showing an optimistic growth trend.
Here’s a quick rundown of Cycle over the last few months of development, the changes that were released in 2.0 and what’s on our roadmap for the rest of the year. As always we love hearing from the community and we are doing our best to support all your requests.
- We launched support for Composite keys – PK (Primary Key) scheme and links now supports composite (multiple) keys
- Proxy entities
Added the ability to create proxy entities that allows lazy loading of relationships.
- Custom collections support
Added support for custom collections for HasMany and ManyToMany relationships. Custom collections can be configured individually for each relationship by specifying aliases and interfaces. You can use Doctrine, Laravel collections, arrays or all of them at once.
Added new ways to project the inheritance hierarchy into the base.
In JTI, each entity in the class hierarchy is mapped to an individual table. Each table contains only the columns of the class associated with it and an identifier column, necessary for joining tables.
STI implies the use of one table for several subclasses of a hierarchy. This means all the attributes of the specified classes in the hierarchy are located in one common table. A special discriminator column is used to determine which data belongs to which class.
Optimizations – July-August 2021
- Added PHP version 8.0 support;
- Added more typing. Class properties and method signatures are more strictly typed. Some external API methods now clarify their return types;
- Transactions persist. Rewrote the algorithm for entity persistence;
- Mapper code is is much simpler and easier to work with the ORM.
Attributes and annotations – August-September 2021
- Partial support for ORM v2 features:
- Composite keys support;
- Renamed constrain to scope;
- PHP 8, psalm, various optimizations.
- ‘Many To Many’ relationship optimizations;
We made a number of Spiral/database enhancements – September 2021
- Added PostgreSQL scheme support;
- Added DSN support when configuring connections;
- Added support for ReadOnly connections.
What to do if you are migrating to the latest version? Check out these changes:
- Spiral/database was moved to cycle/database
It’s development will continue as part of Cycle.
- Migrator was moved to cycle/migrations. The old cycle/migrations was moved to cycle/schema-migrations-generator.
We made a number of different optimizations and enhancements.
- Doctrine Collection
The doctrine/collections was removed from the required section in composer.json.
- Constrain => Scope
Everything associated with Constrain in the ORM is now replaced by Scope.
So what’s on our future roadmap?
October – November 2021
- Add Oracle support
Adding oci8 driver for Oracle support.
- Schema generator
Generation of models based on the database schema.
November – December 2021
- Improvements to typecasters
Create default typecasters and allow users to create their own typecasters, so they don’t have to use custom mappers.
- We plan to develop other Cycle packages: migrations, database, queryBuilder.
Here’s a visual representation of all the information above: