Download the PHP package sledgehammer/orm without Composer
On this page you can find all versions of the php package sledgehammer/orm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sledgehammer/orm
More information about sledgehammer/orm
Files in sledgehammer/orm
Package orm
Short Description Sledgehammer ORM module: Object relational mapping
License CC-BY-SA-3.0
Informations about the package orm
Sledgehammer ORM
The Object-relational mapping (ORM) module for the Sledgehammer Framework.
Features
- Full AutoCompletion support
- POCO support. The Repository can load Plain Old Class Objects (POCO's)
- Detect relations from the database
- An optional ActiveRecord frontend
- Linq style filtering support
- Support for complex property mapping. A column "city" can be mapped to property "address->city"
- 1 database record maps to only 1 instance. via an IdentityMap
- Relations are objects, To set the "customer_id" you'll set the "customer" property to a customer object.
- Cascading save(). A save will update & insert all connected records.
- Support for multiple backends: PDO (MySQL, SQLite), Webservices (Twitter, etc)
- Clean queries. (No "1 = 1" where statements, etc)
Usage
Relations and Placeholders
The relations of objects are loaded on demand via placeholder classes. Just use the object as if all the relations are already loaded:
Works and provides autocompletion all the way.
A downside to the placeholder technique is that:
This is because $order might still be a BelongsToHolder object that will be replaced when used (calling a function, getting or setting a property) Sidenote: A BelongsToHolder often knows the id value and reading $order->id won't trigger a replacement/query.
Update a relation
You wont find any "customer_id" properties in the objects, to change the "customer_id" you'll need to use a customer object.
Don't do this
This is because you're changing the customer object which the repository tries to save before the order and id changes aren't allowed.
Dictionary
Backend: A data retrieval and storing mechanism. Model: A configuration to map backend data to instances. Instance: An object that is created by the Repository from backend data based on a Model.