====== Active Record ====== Active Record connects business objects and database tables to create a persistable domain model where logic and data is presented in one wrapping. It’s an implementation of the object-relational mapping (ORM) "[[http://www.martinfowler.com/eaaCatalog/activeRecord.html|pattern]]" by the same name as described by [[http://www.martinfowler.com/|Martin Fowler]]: An object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data. Active Record's main contribution to the pattern is to relieve the original of two stunting problems: lack of associations and inheritance. By adding a simple domain language-like set of macros to describe the former and integrating the [[SingleTableInheritance]] pattern for the latter, Active Record narrows the gap of functionality between the data-mapper and active record approach. Active Record is also the model part of the [[http://www.akelos.org|php framework Akelos]]. ==== Key Features ==== === No Meta Data === Forget XML configuration files. Active Record is configured on-the-fly without a need for a build phase. === Database Support === [[MySQL]], [[PostgreSQL]] (7.4+), and [[SQLite]] are supported out of the box. Oracle, MSSQL and others are supported but not verified as Akelos. === Transaction Ready === Active Record uses transactions to ensure that dependent deletes are carried out atomically and you can write your own transaction-safe methods as well. === Easy Associations === Describe relationships between classes using natural-language macros, such as [[has_many|has_many]] and [[belongs_to|belongs_to]]. === Validations Built-in === Put the business object in charge of determining the validity of its attributes. === Internationalization Ready === Manage multiple locales of the same value using multilingual columns by prefixing column names with a locale code. === Observable Models === Built in events allow you to intercept the model during its life cycle. === Multiple behaviors === Make a model act a [[acts as list|list]], [[Acts as tree|tree]], [[Acts as nested set|nested set]] or define your own easily. === Calculations === Handy functionality for performing calculations like count, average, minimum, sum, maximum... ===== More information ===== * Introduction on Active Record in the API documentation http://api.akelos.org/ActiveRecord/Base/AkActiveRecord.html * Use of //[[has_many|has_many]]//, //[[belongs_to|belongs_to]]// and //[[how-to-implement-many-to-many-relationships|has_and_belongs_to_many]]// * How to implement a //many to many// relationship [[many_to_many_without_habtm|with use of the fields in the join table]].