2017 © Pedro Peláez
 

library metamodel

image

mnapoli/metamodel

  • Monday, August 19, 2013
  • by mnapoli
  • Repository
  • 1 Watchers
  • 8 Stars
  • 544 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 2 % Grown

The README.md

MetaModel

Meta is a DSL that enables to represent, traverse and operate on PHP objects., (*1)

Build Status Coverage Status, (*2)

Syntax

  • Get a specific object by its ID:
Article(1)

MetaModel integrates with Doctrine, but can be connected to anything., (*3)

  • Get all objects of a type
Article(*)
  • Object graph traversing (get all the articles of a category):
Category(1).articles
  • Call methods:
// Will call generateExtract() on all articles
Article(*).generateExtract()
  • Field filtering (not implemented yet):
Article[author="bob"]

Operators:, (*4)

UserGroup[ users.contains(User(1)) ]
UserGroup[ users.count() > 0 ]
  • Service:
CacheService.flush()

MetaModel integrates with containers, registries, anything…, (*5)

Integration

MetaModel finds objects in data sources. You can add any data source by implementing the simple interfaces: ObjectManager or Container., (*6)

Some libraries are already supported natively:, (*7)

  • Doctrine's Entity Manager: MetaModel\Bridge\Doctrine\EntityManagerBridge, (*8)

    $metaModel = new MetaModel();
    $metaModel->addObjectManager(new EntityManagerBridge($entityManager));
    
  • PHP-DI container: MetaModel\Bridge\PHPDI\PHPDIBridge, (*9)

    $metaModel = new MetaModel();
    $metaModel->addContainer(new PHPDIBridge($container));
    

Add your own by submitting a pull request., (*10)

Usages

Those are both ideas and work in progress., (*11)

Instead of using phpMyAdmin, or building an admin interface, you can manipulate the DB with high level object queries., (*12)

  • Advanced replacement for PropertyAccess, e.g. to build forms, templates (Twig?), (*13)

  • Simplified object queries (from database), (*14)

  • Paths for anything meta on your model: logs, AOP, ACL (e.g. "User(1) can edit Category(12).articles"), (*15)

Projects using MetaModel:, (*16)

The Versions

19/08 2013

dev-master

9999999-dev

  Sources   Download

The Requires

 

The Development Requires

15/07 2013

0.1.0

0.1.0.0

  Sources   Download

The Requires