Compare Sizes
Register
English Français Español

Agile Data

3
Data Access Framework for high-latency databases (Cloud SQL/NoSQL).
PHP Data Access Libraries (ORM, ActiveRecord, Persistence)
Name
Agile Data
Webseitegit.io/ad
Github / Bitbucket / Sourceforgegit.io/ad
LicenseMIT
Latest version1.2.x
How schema is defined?in PHP. Method init() in Model class defines fields, relations, conditions, etc.
Code generationJa https://github.com/atk4/schema
Can be used in Any FrameworkJa Through composer/packagist
Automated CacheJa 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
DependenciesMinimal: 2 packages: DSQL Query Builder (git.io/...
Simplicity
5.0/5 2 ratings
Enterprise Compliance
5.0/5 2 ratings
Minimum PHP Version5.6
Basic Features
PDO SupportJa Yes
Transparent support for NoSQL- Through 3rd party drivers.
How to invoke db-vendor-specific extensions?Ja For SQL - save/load/delete operations are expressed in DSQL Queries that can be manipulated: http://git.io/dsql
Array as a persistenceJa CRUD operations supported
RestAPI as a persistence- Through 3rd party extension.
JSON string as a persistenceJa Supported with few extra lines of code.
Same model, multiple persistencesJa Same class. Different object.
Basic Single-record operations (C,R,U,D)
Table Name MappingJa Yes
Field Name MappingJa Yes (Field::actual property)
Map Entity to SubQueryJa Yes. Extension exist for UNION-models. https://github.com/atk4/report
Map property to expressionJa $model->addExpression()
Map native types (DateTime)Ja $field->type = 'date'
User-defined types (e.g. "23 USD")Ja Yes. Independent from Model. by extending Field class.
Map field of related Entity ('currency' = currency_id->Model Currency.name)Ja Transparently maps into sub-select.
Map field to sub-query on related entity (Client.balance = Client->orders->sum(total))Ja Yes. hasMany()->addField(..aggregate)
Entity to join multiple tables (adding new record populates both tables)Ja $model->join('other_table')
Criteria, Scope, Conditions (Model will refuse to work with records that does not match criteria)
Support model-level criteriaJa Yes. Applied on loading / saving / update.
Soft-deleteJa Through criteria. Example given in the docs.
Domain Model CriteriaJa $m->addCondition('gender','M'); where 'gender' can be arbitrary expression, sub-select, field from association(join) or mapped no another physical field.
Expression-based conditionJa $m->addCondition($m->expr('..'));
Criteria Compliance (new record must match condition)Ja Transaction rollback and exception. Automated-rloading.
Dynamic criteriaJa $user->addCondition('is_expired', false)
Query Building (Convert Model into Query object for further SQL tweaking)
Convert Model into Query ObjectJa $q = $model->action('select');
Raw expressionJa new Expression('any sql')
Nested/Composite Queries/ExpressionsJa Expression can be in any part of query
Reference domain-model field in queryJa through Expressionable interface
field, where, order, limitJa Expressions and Parametric values
options, rollup, partition- Through custom templates, or expressions.
UPDATE, DELETE, INSERT query buildingJa
REPLACE, TRUNCATEJa
SHOW, DESCRIBE, CALL- Supported through Expressions or Custom query template
ALTER, CREATE query buildingJa Addon: http://github.com/atk4/schema
User-defined query templateJa Templates for all queries
full support for OR conditionsJa 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)Ja
Associative Array (id=>value)Nein Planned
Select only required fieldsJa
Typecasting (e.g. DateTime)Ja
Import (multiple records)Ja
Respect domain model mapping (and criteria)Ja
Single rowJa loadAny
Single ValueJa Through action
Single Column- may need to map resulting array
IteratorJa
Bypass persistence mappingJa action('select')->getAll()
Loading and Saving individual records
Load by IDJa load(id)
Load by other fieldJa loadBy('field', $value)
Read-only ModelsJa Yes
Model without primary keyJa Yes, but only in Read-only Mode
Specify fields to loadJa onlyFields()
Save only sends dirty fieldsJa
Guarded / Fillable propertiesJa Conditions and OnlyFields do same thing but more reliably.
Object Hierarchy Model
Admin extends User, adds criteria (is_admin=1)Ja Yes, recommended pattern. "User" class adds condition.
Admin extends User, adds accessible fieldsJa Yes, recommended pattern.
Extend model, add Join (Disjoined SubTypes)Ja Yes. Unlimited number of joins.
Extend model change tableJa 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 ModelJa References are implemented as Objects
One-to-ManyJa $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-loadingNein Anti-pattern
One-to-OneJa $order->hasOne('user_id', new User());
Many-to-ManyJa $user->addCondition('vip', true)->ref('Orders');
Deep Many-to-Many traversal.Ja $user->ref('Orders')->ref('Payments')->action('count'); No intermediate queries.
Cross-Persistence traversalJa $user->hasMany('Log', new Log($mongodb));
Cross-persistence joins, aggregation, reporting
Multi-persistence joinNein
UNION existing modelsJa Yes, in add-on https://github.com/atk4/report/. Can join UNION result with more tables.
Domain-model AggregationJa Group by multiple fields. Apply aggregation functions. Preserve types.
Model to Model joinNein Planned.
Multi-persistence UNIONNein
Behaviours / Hooks
Before/After operationJa
Override standard C,R,U,D operationsJa
Persistence-specific hooks (to modify Query)Ja
User-defined hooksJa
Auditing
Global AuditingJa http://www.agiletoolkit.org/data/extensions/audit
Store old/new field valuesJa Yes in JSON and user-readable string.
Revert action (undo) and replay (redo)Ja
Reactive actionsJa Each action will be automatically linked with sub-actions which may be invoked through Hooks.
Store log in any persistenceJa
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 eventsJa
Access to record-specific historyJa $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 providedType, caption, possible values, mapped field, join table spec, encryption, serialization, UI-specific settings, validation rules.
UI extensionsJa CRUD, Form, Table, Grid, Entity-manager. (see https://github.com/atk4/ad)
API extensionsJa RestFULL API, automated CRUD operations + RPC https://github.com/atk4/api
Products
English
Public
Public
2017-12-20 01:05:19
View changes

User reviews and comments

  • Gowrav on 2016-10-25 19:16:29
    like this

    Couldn't work on any other framework/orm after switching to ATK. Its just how every programmer always wanted ...

  • Gowrav on 2016-10-25 18:51:02
    rated this Item: Enterprise Compliance 5/5

    Using in Recent modules of our ERP

  • Gowrav on 2016-10-25 18:50:37
    rated this Item: Simplicity 5/5

    Most simple among what I used (almost all popular ones)

  • Romans Malinovskis on 2016-10-24 02:18:39
    like this

    Not really an ORM, but offers much more powerful support for Domain Model.