Get support for mnapoli/MetaModel

If you're new to LTH, please see our FAQ for more information on what it is we do.

Support Options

Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:

View Open Issues

Take a look to see if anyone else has experienced the same issue as you and if they managed to solve it.

Open an Issue

Make sure to read any relevant guidelines for opening issues on this repo before posting a new issue.

Sponsor directly

Check out the page and see if there are any options to sponsor this project or it's developers directly.

mnapoli/MetaModel

MetaModel

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

Build Status Coverage Status

Syntax

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

MetaModel integrates with Doctrine, but can be connected to anything.

  • 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:

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

MetaModel integrates with containers, registries, anything…

Integration

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

Some libraries are already supported natively:

  • Doctrine's Entity Manager: MetaModel\Bridge\Doctrine\EntityManagerBridge

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

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

Add your own by submitting a pull request.

Usages

Those are both ideas and work in progress.

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

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

  • Simplified object queries (from database)

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

Projects using MetaModel:

Our Mission

We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.

Interesting Articles

Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated

p-e622a1a2