Download the PHP package ronanchilvers/silex-spot2-provider without Composer
On this page you can find all versions of the php package ronanchilvers/silex-spot2-provider. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ronanchilvers/silex-spot2-provider
More information about ronanchilvers/silex-spot2-provider
Files in ronanchilvers/silex-spot2-provider
Package silex-spot2-provider
Short Description Provider for the Spot2 orm (vlucas/spot2)
License MIT
Informations about the package silex-spot2-provider
Silex Provider for the Spot2 ORM
Spot2 is a simple ORM for Silex projects based on the data mapper pattern. You can read more about it on the github page or the documentation site.
This project comprises a service provider and utility for hooking Spot2 up to your Silex app.
Installation
The easiest mechanism is via composer. :
Silex2 is supported in the master branch although there isn't yet a release. If you want to use the Silex2 version you can do:
Usage
To register the service provider you can do something like this:
Utility trait
If you want to use the utility trait, just include it in your subclassed application.
You then get the following convenience methods.
mapper()
This method is a shortcut for getting a mapper out for a particular entity.
spot2()
This method is a shortcut for getting the spot2 locator object. Most of the time you won't use this method (you'll probably use mapper() instead). It exists just to allow easy access to the locator if required.
Services Exposed
The Spot2ServiceProvider exposes the following services.
spot2.connections
- an array of connection DSNs or DBAL style configuration arraysspot2.connections.default
- the name of the default connection to use. Spot2 will take the first defined one as the default if you don't set one explicitly.spot2.config
- the Spot2 config objectspot2.locator
- the Spot2 locator object