Mit Object Relational Mapper kann Objekte in einer relationen Datenbank abbilden. In PHP gibt es folgende ORM:
Doctrine
Für Doctrine gibt es zwischenzeitlich in der Version 1.0.3. Doctrine hat folgende Features:
- Behaviors
- Caching
- Class Templates
- Command Line Interface
- DQL (Doctrine Query Language)
- Data Fixtures
- Hierarchical Data
- Migrations
- Native SQL
- Sandbox
- Schema Files
- Search Indexing
- Transactions
- Validators
Propel
Propel ist auch ein ORM-Toolset welches auf Apache Torque basiert. Propel bestitzt folgende Eigenschaften:
- Easily extensible.
Use of XML schemas makes it possible to easily integrate with other components driven by your data model (e.g. a form generation tool could also use the same XML schema) or to extend the schema definition to include attributes for other components (e.g. more validation informat for that form tool).
- Easily customizable.
The generated object model is built to be customized. All internal calls are made to empty stub classes which extend the classes with generated logic. You can override behavior in the stub classes or provide your own custom business logic without sacrificing the ability to rebuild your object model at a later time.
- Plays nice.
This is a way of saying that Propel doesn't force you to use only Propel tools. For example, while you can use the Criteria objects to construct queries without writing SQL, we recognize that Criteria doesn't do everything and so we've also made it easy to use custom SQL to populate generated objects.
- Truly independent.
The use of a build process to create customized SQL and PHP classes means that your database interactions with Propel are truly database-independent -- taking advantage of the strengths of your RDBMS and providing emulation for things your RDBMS doesn't support (e.g. fkey cascading deletes in MySQL). Tools are also provided to easily move data from one RDBMS to another.
- Intuitive, Predictable.
Propel's data model definition is follows very closely the structure of the underlying database. This provides the advantage of making Propel easy to understand and also of behaving predictably with very complex data models.
- Advanced.
Propel makes the difficult relational problems easy and efficient. For example, Propel provides the ability to populate related (foreign key) objects from a single query. Propel also supports basic (table per class tree) inheritance and other advanced OO features.
Ich habe direkt mit beiden noch nicht gearbeitet. Indirekt über Symfony mit Propel - deshalb kann ich keine persönliche Beurteilung geben, welche der ORMs besser ist. Viele Entwickler empfinden aber Doctrine als handlicher und schneller.