Agile Data

2017-12-20 01:05:19
Data Access Framework for high-latency databases (Cloud SQL/NoSQL).
PHP Data Access Libraries (ORM, ActiveRecord, Persistence)
Agile Data
Site web
Github / Bitbucket / Sourceforge
Dernière version1.2.x
How schema is defined?in PHP. Method init() in Model class defines fields, relations, conditions, etc.
Code generationOui
Can be used in Any FrameworkOui Through composer/packagist
Automated CacheOui 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.
DependenciesMinimal: 2 packages: DSQL Query Builder (
Simplicité5.0 2 notes
Enterprise Compliance5.0 2 notes
Minimum PHP Version5.6
Basic Features
PDO SupportOui 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:
Array as a persistenceOui CRUD operations supported
RestAPI as a persistence- Through 3rd party extension.
JSON string as a persistenceOui Supported with few extra lines of code.
Same model, multiple persistencesOui Same class. Different object.
Basic Single-record operations (C,R,U,D)
Table Name MappingOui Yes
Field Name MappingOui Yes (Field::actual property)
Map Entity to SubQueryOui Yes. Extension exist for UNION-models.
Map property to expressionOui $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 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 criteriaOui Yes. Applied on loading / saving / update.
Soft-deleteOui Through criteria. Example given in the docs.
Domain Model CriteriaOui $m->addCondition('gender','M'); where 'gender' can be arbitrary expression, sub-select, field from association(join) or mapped no another physical field.
Expression-based conditionOui $m->addCondition($m->expr('..'));
Criteria Compliance (new record must match condition)Oui Transaction rollback and exception. Automated-rloading.
Dynamic criteriaOui $user->addCondition('is_expired', false)
Query Building (Convert Model into Query object for further SQL tweaking)
Convert Model into Query ObjectOui $q = $model->action('select');
Raw expressionOui new Expression('any sql')
Nested/Composite Queries/ExpressionsOui Expression can be in any part of query
Reference domain-model field in queryOui through Expressionable interface
field, where, order, limitOui Expressions and Parametric values
options, rollup, partition- Through custom templates, or expressions.
UPDATE, DELETE, INSERT query buildingOui
SHOW, DESCRIBE, CALL- Supported through Expressions or Custom query template
ALTER, CREATE query buildingOui Addon:
User-defined query templateOui Templates for all queries
full support for OR conditionsOui 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 fieldsOui
Typecasting (e.g. DateTime)Oui
Import (multiple records)Oui
Respect domain model mapping (and criteria)Oui
Single rowOui loadAny
Single ValueOui Through action
Single Column- may need to map resulting array
Bypass persistence mappingOui action('select')->getAll()
Loading and Saving individual records
Load by IDOui load(id)
Load by other fieldOui loadBy('field', $value)
Read-only ModelsOui Yes
Model without primary keyOui Yes, but only in Read-only Mode
Specify fields to loadOui onlyFields()
Save only sends dirty fieldsOui
Guarded / Fillable propertiesOui 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 fieldsOui Yes, recommended pattern.
Extend model, add Join (Disjoined SubTypes)Oui Yes. Unlimited number of joins.
Extend model change tableOui 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 ModelOui References are implemented as Objects
One-to-ManyOui $user->hasMany('Orders', new Order());
One-to-many traversal strategyReturns 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-loadingNon Anti-pattern
One-to-OneOui $order->hasOne('user_id', new User());
Many-to-ManyOui $user->addCondition('vip', true)->ref('Orders');
Deep Many-to-Many traversal.Oui $user->ref('Orders')->ref('Payments')->action('count'); No intermediate queries.
Cross-Persistence traversalOui $user->hasMany('Log', new Log($mongodb));
Cross-persistence joins, aggregation, reporting
Multi-persistence joinNon
UNION existing modelsOui Yes, in add-on Can join UNION result with more tables.
Domain-model AggregationOui Group by multiple fields. Apply aggregation functions. Preserve types.
Model to Model joinNon Planned.
Multi-persistence UNIONNon
Behaviours / Hooks
Before/After operationOui
Override standard C,R,U,D operationsOui
Persistence-specific hooks (to modify Query)Oui
User-defined hooksOui
Global AuditingOui
Store old/new field valuesOui Yes in JSON and user-readable string.
Revert action (undo) and replay (redo)Oui
Reactive actionsOui Each action will be automatically linked with sub-actions which may be invoked through Hooks.
Store log in any persistenceOui
Override, Add fields to audit logRecord 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 eventsOui
Access to record-specific historyOui $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
Field meta-information providedType, caption, possible values, mapped field, join table spec, encryption, serialization, UI-specific settings, validation rules.
UI extensionsOui CRUD, Form, Table, Grid, Entity-manager. (see
API extensionsOui RestFULL API, automated CRUD operations + RPC
J'aime 2
  • 2016-10-18 22:11:55
    2017-12-20 01:05:19
  • Produits
  • Publique
  • Creative Commons License CC-BY-SA 3.0 / GNU FDL


  • a voté pour ce Elément (J'aime)
    Couldn't work on any other framework/orm after switching to ATK. Its just how every programmer always wanted ...
    English Posté 2016-10-25 19:16:29 par Gowrav
  • a noté ce Elément: Enterprise Compliance 5
    Using in Recent modules of our ERP
    English Posté 2016-10-25 18:51:02 par Gowrav
  • a noté ce Elément: Simplicité 5
    Most simple among what I used (almost all popular ones)
    English Posté 2016-10-25 18:50:37 par Gowrav
  • a voté pour ce Elément (J'aime)
    Not really an ORM, but offers much more powerful support for Domain Model.
    English Posté 2016-10-24 02:18:39 par Romans Malinovskis
  • a noté ce Elément: Enterprise Compliance 5
    Posté 2016-10-18 22:34:27 par Romans Malinovskis
  • a noté ce Elément: Simplicité 5
    Posté 2016-10-18 22:14:01 par Romans Malinovskis

Laisser un commentaire

Créer des tableaux comparatifs ou listes sur tout !

C'est gratuit et rapide de créer des tableaux originaux

Créer un tableau