After more months of breaks, changes, additions, and refactoring, I’m (finallly) at the point where I’m ready to call the Solar framework for PHP 5 feature-complete. The first of this feature-complete series is the new Solar-1.0.0alpha1 release as of Sunday, 11 Nov, 2007. We now have at least 80% of everything you would need to build web-based and cli-based applications. This is a big milestone for the project.
The change notes, of course, are gigantically long, so they’re on a separate page.
Read on for more highlights, especially about the new ORM system replacing the previous Solar_Sql_Table series.
The new Solar_Controller_Console and Solar_Controller_Command classes are analagous to front and page controllers, respectively, for the command line. This means you can build CLI commands in Solar much the same as you build web apps.
The new Solar_Filter class combines validating and sanitizing. It uses a helper structure identical to Solar_View so you can add your own filter helper classes. It also comes with a filter-chain system for applying filters to arrays or structs of user input.
Lots of changes in the Solar_Sql package related to database portability. There are two removals here: we don’t ship with Oracle or MS-SQL any more, only MySQL, PostgreSQL, and SQLite. These are not permanent removals; as soon as I can get systems to test on, I’ll put Oracle and MS-SQL back in place with all the new SQL portability goodness.
New ORM System
The biggest set of changes, though, are that the venerable Solar_Sql_Table and its companions have been removed in favor of some new hotness: Solar_Sql_Model. The new model class is still table-based, but it now recognizes related tables using has-one, belongs-to, and has-many relationships. (Strictly speaking, we don’t have "has-and-belongs-to-many"; we use "has-many-through" instead.) It features single-table inheritance, built-in filtering, automatic table creation, automatic form-processor generation, and lots of other goodies.
Along with the table-based model class, we also have Solar_Sql_Model_Record and Solar_Sql_Model_Collection classes to represent, respectively, individual records and collections of records. The record class allows you to add business logic on the individual rows and related rows returned by the model, so technically the record class is an ActiveRecord pattern implementation. (Note that this is not a Rails ActiveRecord.) Similarly, the collection class allows you to add logic on a set of records.
Oscar Merida has added a getting-started page about Solar_Sql_Model on the community wiki here: http://solarphp.org/wiki/tutorials/SettingUpModels.
The Model class is almost where I want it to be for a full stable release, but it still needs a bit of tweaking. Other than that, the only things left for Solar are building a more-complete suite of unit tests, and writing more narrative documentation. As the tests fill out and we get more user feedback, I’ll be able to move to a beta, then quickly to an official stable release.
Many thanks to all the people who have helped with this release in one way or another (and in no particular order): Clay Loveless, Rodrigo Moraes, Antti Holvikari, Chris Cornutt, Jeff Surgeson, Robert Gonzalez, and all the others on the mailing lists and the IRC channel and who are noted in the change logs but whose names escape me now. Thanks guys!