Home - Redpill-Linpro/gamine GitHub Wiki

Introduction

Gamine is an annotations-based ORM for REST-based data sources, written in PHP (>=5.3). It comes with a service adapter for Mongo, and a generic REST service adapter.

Gamine can use multiple service backends for different data sources simultaneously, and can even use different service backends for the same object types when desired.

The current version of Gamine is packaged as a symfony2 bundle and can be used as an alternative to, or alongside Doctrine.

Getting started

Prerequisites

To get started using Gamine, you will need php version 5.3 or later and a symfony2 project. You will have to add the GamineBundle to your symfony2 project (including setting it up in the AppKernel.php, etc) before you get started.

Configuration

Gamine uses an Entity / Manager combination where the Manager is responsible for storage and retrieval, and the Entity is any regular PHP object you want managed (a managed object is an object that has a related Manager, and that can be stored by Gamine).

To work with symfony2, you must configure Gamine as a global service in your application's services.yml file. You only need one Gamine service, and this service is configured with the various backends and entities required by your application.

Managing objects

Any object you want managed must extend the GamineBundle\Model\BaseModel class. This is the base class that takes care of tasks such as autopopulating objects, translating the REST data and "lazy"loading. The BaseModel class does not overwrite object constructors and will not be invoked or used unless you're using Gamine functionality such as instantiating it via a Manager, or saving it through a manager.