3.2. Major Components and Patterns

These are the component classes in the Solar model system, and their corresponding enterprise application design pattern descriptions.

  • Solar_Sql_Model acts as a TableDataGateway and DataMapper (albeit currently without IdentityMap support) to allow you to fetch rows from the database and convert them into records and collections. It uses MetadataMapping to retain column and index information, and supports SingleTableInheritance along with other automated column processing logic.

  • Solar_Sql_Model_Record represents a single entity with data and business logic methods. This looks a bit like ActiveRecord, but depends on the model/mapper object for database interactions, so it's not an ActiveRecord proper.

  • Solar_Sql_Model_Collection represents a collection of record objects from the same model.

  • Solar_Sql_Model_Related describes the relationships between models and is responsible for coordinating the retrieval of related data. It uses such patterns as ForeignKeyMapping and AssociationTableMapping.

  • Finally, Solar_Sql_Model_Catalog provides a way for you to retrieve model instances by name using a class stack, instead of having to factory them each time you need to interact with a model. This has the added benefit of reducing resource usage, because the catalog retains only one instance of each model. (You can think of the catalog as a Registry implementation specifically for model obects.)