2016-10-21 18:57:20
PHP Data Access Libraries (ORM, ActiveRecord, Persistence)
Site web
Github / Bitbucket / Sourceforge
Dernière version
How schema is defined?Model class properties
Code generation
Can be used in Any FrameworkOui Through Capsule
Automated CacheOui
Anti-patterns (purposely included)Eloquent is a God Class; Global functions; DB Conection is global;
Simplicité0 aucune note
Enterprise Compliance3.0 1 note
Minimum PHP Version
Basic Features
PDO SupportOui
NoSQL Integrate TransparentlyNon Eloquent is built on Query Builder.
How to invoke db-vendor-specific extensions?Oui Through Query Builder / RAW queries.
Array as a persistence
RestAPI as a persistence
JSON string as a persistence
Same model, multiple persistences
Persistence Mapping (must support C,R,U,D)
Table Name MappingOui Same as model class name by default
Field Name Mapping- Through accessors/3rd party extension
Map Entity to SubQueryNon Must be physical table.
Map property to expressionNon Must be physical table
Map native types (DateTime)Oui Accessors and Mutators
User-defined types (e.g. "23 USD")Oui Accessors and Mutators
Map field of related Entity ('currency' = currency_id->Model Currency.name)- Relationship, but only single record.
Map field to sub-query on related entity (Client.balance = Client->orders->sum(total))Non
Entity to join multiple tables (adding new record populates both tables)Non
NoSQL (must be transparent to domain logic)
MongoDB supportNon
MemCache- Through Caching backend, but not as ORM native persistence.
Criteria, Scope, Conditions (Model will refuse to work with records that does not match criteria)
Support model-level criteria
Soft-deleteOui Trait and Scope
Domain Model Criteria- Scopes, but not in domain model.
Expression-based conditionNon Scopes only affect loading.
Criteria Compliance (new record must match condition)
Dynamic criteria
Query Building (Convert Model into Query object for further SQL tweaking)
Convert Model into Query ObjectOui Model is a Query object. See: Model::where()
Raw expressionOui DB::raw()
Nested/Composite Queries/ExpressionsNon
Reference domain-model field in queryNon No fields. Only properties.
field, where, order, limitOui
options, rollup, partition
UPDATE, DELETE, INSERT query building
ALTER, CREATE query building
User-defined query template
OR deep nested conditions
Use Domain logic in multi-record updateNon
Data Fetching (different ways to retrieve data from database)
Get All Data (2x array)Oui
Associative Array (id=>value)Oui lists()
Single rowOui
Single ValueOui
Single ColumnOui
Bypass persistence mapping- ?? (e..g prevent date from being transformed into Carbon)
Loading and Saving individual records
Load by ID
Load by other field
Load if expression
Load respects Scope (model-level condition)
Specify fields to loadNon Fields load with SELECT *
Save only sends dirty fieldsOui
Guarded / Fillable propertiesOui Prevents "create($_GET)" from messing up important fields.
Object Hierarchy Model
Admin extends User (is_admin=1)Non Both have to use "User" model.
Model that represent Orders of single User.Non Both have to use "Order" model.
Extend model, add Join (Disjoined SubTypes)Non
Extend model change table
Relations/References (One model can relate to another model. NOT A TABLE JOIN)
Model can define relation to other ModelOui Relations
One-to-many traversal strategyReturns array of objects that may either be pre-loaded with record data or only contain IDs (lazy-loaded).
Deep Many-to-Many traversal.
Cross-Persistence traversal
Multi-persistence Mapping (some data from SQL, others MongoDB)
Multi-persistence joinNon
UNION existing modelsNon
Multi-persistence UNIONNon
Multi-persistence value linking (current_sensor_value)
Behaviours / Hooks
Before/After operation
Hooks for C,R,U,D operations
Persistence-specific hooks (to modify Query)
User-defined hooks
Mapping strategy
How to set-up
Store old/new field values
Date of creation, modification
User/IP creation, modification
Store incremental revisionsOui
Revert action (undo)Non
Custom events
Custom fields, table
Store in CSV
Access to record-specific history
Access Control
Implementation Strategy
Single-system global access scopeNon
Meta-information (allows exploration by UI widgets)
Implementation StrategyEloquent is designed to work with MVC engines, where view is mandatory and would be defining how model properties fit into your HTML.
UI Widget can fetch list of Model FieldsNon Would have to manually specify fields.
UI Widget can get Field type, default value, caption, hintNon
field storing reference to another Model can map into DropDownNon Must manually specify object with lists() method.
J'aime 0
  • 2016-10-18 22:11:55
    2016-10-21 18:57:20
  • Produits
  • Publique
  • Creative Commons License CC-BY-SA 3.0 / GNU FDL

Créer des tableaux comparatifs ou listes sur tout !

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

Créer un tableau