Yii ORM
Likes 1
Name | Yii ORM |
|---|---|
| Webseite | yiiframework.com |
| Github / Bitbucket / Sourceforge | github.com/... |
| License | BSD-3 |
| Latest version | 2.0.10 |
| How schema is defined? | Active record magic properties. |
| Code generation | Ja Web and console generator https://github.com/yiisoft/yii2-gii |
| Can be used in Any Framework | - Planned in 2.1.x |
| Automated Cache | Ja |
| Anti-patterns (purposely included) | |
| Audience | |
| Dependencies | |
| Simplicity | 5.0/5 2 ratings |
| Enterprise Compliance | 4.5/5 2 ratings |
| Minimum PHP Version | 5.4 |
| Basic Features | |
| PDO Support | Ja |
| Transparent support for NoSQL | Ja Avialable cross sql and nosql datababase relations (https://github.com/yiisoft/yii2-mongodb) |
| How to invoke db-vendor-specific extensions? | Ja SQL - Query Builder. |
| Array as a persistence | Ja https://github.com/yii2tech/filedb |
| RestAPI as a persistence | - To extend BaseActiveRecord |
| JSON string as a persistence | - To extend BaseActiveRecord |
| Same model, multiple persistences | - (no docs) |
| Basic Single-record operations (C,R,U,D) | |
| Table Name Mapping | Ja Using static method of active record. http://www.yiiframework.com/doc-2.0/guide-db-active-record.html#declaring-ar-classes |
| Field Name Mapping | Ja |
| Map Entity to SubQuery | - table = new Expression(..) |
| Map property to expression | - (couldn't find docs) |
| Map native types (DateTime) | Ja Active record behaviors |
| User-defined types (e.g. "23 USD") | Ja Active record behaviors |
| Map field of related Entity ('currency' = currency_id->Model Currency.name) | Ja $model->currency->name |
| Map field to sub-query on related entity (Client.balance = Client->orders->sum(total)) | - (couldn't find docs) |
| Entity to join multiple tables (adding new record populates both tables) | Nein No native support. |
| Criteria, Scope, Conditions (Model will refuse to work with records that does not match criteria) | |
| Support model-level criteria | Nein |
| Soft-delete | Ja Events and behaviors |
| Domain Model Criteria | Nein Only for specific query: User::find()->byEmail('...')->active()->one() |
| Expression-based condition | Nein Only for query: User::find()->andWhere('...')->all() |
| Criteria Compliance (new record must match condition) | Nein |
| Dynamic criteria | Nein Only Querying: User::find()->where(['a' => '1', 'b' => true])->all(); |
| Query Building (Convert Model into Query object for further SQL tweaking) | |
| Convert Model into Query Object | Ja \yii\db\ActiveRecord::find() |
| Raw expression | Ja new \yii\db\Expression('...') |
| Nested/Composite Queries/Expressions | Ja Expression can be in any part of query |
| Reference domain-model field in query | Nein Field is class property. |
| field, where, order, limit | Ja \yii\db\ActiveQuery |
| options, rollup, partition | |
| UPDATE, DELETE, INSERT query building | Ja |
| REPLACE, TRUNCATE | - Throught raw sql in \yii\db\Command |
| SHOW, DESCRIBE, CALL | - Throught raw sql in \yii\db\Command |
| ALTER, CREATE query building | Ja |
| User-defined query template | Ja (please link doc) |
| full support for OR conditions | - |
| Use Domain logic in multi-record update | Nein |
| Data Fetching (different ways to retrieve data from database) | |
| Get All Data (2x array) | Ja \yii\db\Query::all() |
| Associative Array (id=>value) | |
| Select only required fields | |
| Typecasting (e.g. DateTime) | |
| Import (multiple records) | |
| Respect domain model mapping (and criteria) | |
| Single row | Ja \yii\db\Query::one() |
| Single Value | Ja \yii\db\Query::scalar() |
| Single Column | Ja \yii\db\Query::column() |
| Iterator | Ja |
| Bypass persistence mapping | |
| Loading and Saving individual records | |
| Load by ID | Ja User::findOne(1) |
| Load by other field | Ja User::findOne(['id' => 1]) |
| Read-only Models | |
| Model without primary key | |
| Specify fields to load | Ja User::find()->select([])->one() |
| Save only sends dirty fields | Ja |
| Guarded / Fillable properties | |
| Object Hierarchy Model | |
| Admin extends User, adds criteria (is_admin=1) | Nein Can be done as wrapper: User::findAdmin(..) or custom CDbCriteria |
| Admin extends User, adds accessible fields | Nein |
| Extend model, add Join (Disjoined SubTypes) | Nein |
| Extend model change table | |
| Relations/References (One model can relate to another model. NOT A TABLE JOIN) | |
| Model can define relation to other Model | Ja Relations |
| One-to-Many | Ja |
| One-to-many traversal strategy | Uses classical eager/lazy loading approach. with() can help pre-fetch the data for related entities. |
| Lazy/Eager-loading | Ja |
| One-to-One | Ja |
| Many-to-Many | Ja relations() method of an entity can define. |
| Deep Many-to-Many traversal. | - only with "to-one" references: $book->author->address->street; Executes multiple queries. |
| Cross-Persistence traversal | - No docs. |
| Cross-persistence joins, aggregation, reporting | |
| Multi-persistence join | |
| UNION existing models | |
| Domain-model Aggregation | |
| Model to Model join | |
| Multi-persistence UNION | |
| Behaviours / Hooks | |
| Before/After operation | Ja |
| Override standard C,R,U,D operations | Ja |
| Persistence-specific hooks (to modify Query) | - (no docs) |
| User-defined hooks | Ja |
| Auditing | |
| Global Auditing | |
| Store old/new field values | Ja |
| Revert action (undo) and replay (redo) | Nein |
| Reactive actions | |
| Store log in any persistence | Nein |
| Override, Add fields to audit log | |
| Custom events | Ja |
| Access to record-specific history | - Through a custom query. |
| Date of creation, modification | Ja \yii\behaviors\TimestampBehavior |
| User/IP creation, modification | Ja \yii\behaviors\BlameableBehavior |
| Store incremental revisions | |
| Integration | |
| Field meta-information provided | |
| UI extensions | Nein |
| API extensions |
User reviews and comments
Easiest ORM, I think!