Site web | http://git.io/ad |
---|
Github / Bitbucket / Sourceforge | http://git.io/ad |
---|
Licence | MIT |
---|
Dernière version | 1.2.x |
---|
How schema is defined? | in PHP. Method init() in Model class defines fields, relations,
conditions, etc. |
---|
Code generation | Oui https://github.com/atk4/schema |
---|
Can be used in Any Framework | Oui Through composer/packagist |
---|
Automated Cache | Oui Frameworks focuses on optimizing queries rather then caching. Still possible with cross-persistence saving. |
---|
Anti-patterns (purposely included) | Model close-coupled with Persistence and Field classes. |
---|
Audience | |
---|
Dependencies | Minimal: 2 packages: DSQL Query Builder (http://git.io/dsql) |
---|
Simplicité | 5.0 2 notes |
---|
Enterprise Compliance | 5.0 2 notes |
---|
Minimum PHP Version | 5.6 |
---|
Basic Features | |
---|
PDO Support | Oui Yes |
---|
Transparent support for NoSQL | - Through 3rd party drivers. |
---|
How to invoke db-vendor-specific extensions? | Oui For SQL - save/load/delete operations are expressed in DSQL Queries that can be manipulated: http://git.io/dsql |
---|
Array as a persistence | Oui CRUD operations supported |
---|
RestAPI as a persistence | - Through 3rd party extension. |
---|
JSON string as a persistence | Oui Supported with few extra lines of code. |
---|
Same model, multiple persistences | Oui Same class. Different object. |
---|
Basic Single-record operations (C,R,U,D) | |
---|
Table Name Mapping | Oui Yes |
---|
Field Name Mapping | Oui Yes (Field::actual property) |
---|
Map Entity to SubQuery | Oui Yes. Extension exist for UNION-models. https://github.com/atk4/report |
---|
Map property to expression | Oui $model->addExpression() |
---|
Map native types (DateTime) | Oui $field->type = 'date' |
---|
User-defined types (e.g. "23 USD") | Oui Yes. Independent from Model. by extending Field class. |
---|
Map field of related Entity ('currency' = currency_id->Model Currency.name) | Oui Transparently maps into sub-select. |
---|
Map field to sub-query on related entity (Client.balance = Client->orders->sum(total)) | Oui Yes. hasMany()->addField(..aggregate) |
---|
Entity to join multiple tables (adding new record populates both tables) | Oui $model->join('other_table') |
---|
Criteria, Scope, Conditions (Model will refuse to work with records that does not match criteria) | |
---|
Support model-level criteria | Oui Yes. Applied on loading / saving / update. |
---|
Soft-delete | Oui Through criteria. Example given in the docs. |
---|
Domain Model Criteria | Oui $m->addCondition('gender','M'); where 'gender' can be arbitrary expression, sub-select, field from association(join) or mapped no another physical field. |
---|
Expression-based condition | Oui $m->addCondition($m->expr('..')); |
---|
Criteria Compliance (new record must match condition) | Oui Transaction rollback and exception. Automated-rloading. |
---|
Dynamic criteria | Oui $user->addCondition('is_expired', false) |
---|
Query Building (Convert Model into Query object for further SQL tweaking) | |
---|
Convert Model into Query Object | Oui $q = $model->action('select'); |
---|
Raw expression | Oui new Expression('any sql') |
---|
Nested/Composite Queries/Expressions | Oui Expression can be in any part of query |
---|
Reference domain-model field in query | Oui through Expressionable interface |
---|
field, where, order, limit | Oui Expressions and Parametric values |
---|
options, rollup, partition | - Through custom templates, or expressions. |
---|
UPDATE, DELETE, INSERT query building | Oui |
---|
REPLACE, TRUNCATE | Oui |
---|
SHOW, DESCRIBE, CALL | - Supported through Expressions or Custom query template |
---|
ALTER, CREATE query building | Oui Addon: http://github.com/atk4/schema |
---|
User-defined query template | Oui Templates for all queries |
---|
full support for OR conditions | Oui Through Object Composition and Expressions |
---|
Use Domain logic in multi-record update | - Supported, but must map fields/values manually. |
---|
Data Fetching (different ways to retrieve data from database) | |
---|
Get All Data (2x array) | Oui |
---|
Associative Array (id=>value) | Non Planned |
---|
Select only required fields | Oui |
---|
Typecasting (e.g. DateTime) | Oui |
---|
Import (multiple records) | Oui |
---|
Respect domain model mapping (and criteria) | Oui |
---|
Single row | Oui loadAny |
---|
Single Value | Oui Through action |
---|
Single Column | - may need to map resulting array |
---|
Iterator | Oui |
---|
Bypass persistence mapping | Oui action('select')->getAll() |
---|
Loading and Saving individual records | |
---|
Load by ID | Oui load(id) |
---|
Load by other field | Oui loadBy('field', $value) |
---|
Read-only Models | Oui Yes |
---|
Model without primary key | Oui Yes, but only in Read-only Mode |
---|
Specify fields to load | Oui onlyFields() |
---|
Save only sends dirty fields | Oui |
---|
Guarded / Fillable properties | Oui Conditions and OnlyFields do same thing but more reliably. |
---|
Object Hierarchy Model | |
---|
Admin extends User, adds criteria (is_admin=1) | Oui Yes, recommended pattern. "User" class adds condition. |
---|
Admin extends User, adds accessible fields | Oui Yes, recommended pattern. |
---|
Extend model, add Join (Disjoined SubTypes) | Oui Yes. Unlimited number of joins. |
---|
Extend model change table | Oui Yes. Used to tweak 3rd party models. |
---|
Relations/References (One model can relate to another model. NOT A TABLE JOIN) | |
---|
Model can define relation to other Model | Oui References are implemented as Objects |
---|
One-to-Many | Oui $user->hasMany('Orders', new Order()); |
---|
One-to-many traversal strategy | Returns destination model instance with dynamically applied
criteria (parent_id=123). No queries are executed. Inserting record
into this model will ensure association with parent model. |
---|
Lazy/Eager-loading | Non Anti-pattern |
---|
One-to-One | Oui $order->hasOne('user_id', new User()); |
---|
Many-to-Many | Oui $user->addCondition('vip', true)->ref('Orders'); |
---|
Deep Many-to-Many traversal. | Oui $user->ref('Orders')->ref('Payments')->action('count'); No intermediate queries. |
---|
Cross-Persistence traversal | Oui $user->hasMany('Log', new Log($mongodb)); |
---|
Cross-persistence joins, aggregation, reporting | |
---|
Multi-persistence join | Non |
---|
UNION existing models | Oui Yes, in add-on https://github.com/atk4/report/. Can join UNION result with more tables. |
---|
Domain-model Aggregation | Oui Group by multiple fields. Apply aggregation functions. Preserve types. |
---|
Model to Model join | Non Planned. |
---|
Multi-persistence UNION | Non |
---|
Behaviours / Hooks | |
---|
Before/After operation | Oui |
---|
Override standard C,R,U,D operations | Oui |
---|
Persistence-specific hooks (to modify Query) | Oui |
---|
User-defined hooks | Oui |
---|
Auditing | |
---|
Global Auditing | Oui http://www.agiletoolkit.org/data/extensions/audit |
---|
Store old/new field values | Oui Yes in JSON and user-readable string. |
---|
Revert action (undo) and replay (redo) | Oui |
---|
Reactive actions | Oui Each action will be automatically linked with sub-actions which may be invoked through Hooks. |
---|
Store log in any persistence | Oui |
---|
Override, Add fields to audit log | Record dirty fields before persisting. Type-cast into JSON string
and store in a single field of AuditLog Model. This model can be
persisted anywhere, table, file, etc. |
---|
Custom events | Oui |
---|
Access to record-specific history | Oui $item->ref('AuditLog'); |
---|
Date of creation, modification | - No but easy to add through hook. |
---|
User/IP creation, modification | - Easy to add through a hook. |
---|
Store incremental revisions | - Easy to add through a hook |
---|
Integration | |
---|
Field meta-information provided | Type, caption, possible values, mapped field, join table spec,
encryption, serialization, UI-specific settings, validation rules. |
---|
UI extensions | Oui CRUD, Form, Table, Grid, Entity-manager. (see https://github.com/atk4/ad) |
---|
API extensions | Oui RestFULL API, automated CRUD operations + RPC https://github.com/atk4/api |
---|
J'aime | 2 J'aime |
---|
Plus de comparatifs
Commentaires
Laisser un commentaire
S'inscrire Se connecter