2017 © Pedro PelĂĄez
 

library pimple

Provider to use Mongator with Pimple/Silex framework

image

mongator/pimple

Provider to use Mongator with Pimple/Silex framework

  • Wednesday, May 21, 2014
  • by mcuadros
  • Repository
  • 2 Watchers
  • 2 Stars
  • 99 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Mongator Pimple/Silex Provider Build Status

Provider for using Mongator with Pimple/Silex framework, (*1)

Requirements

  • PHP 5.3.x
  • Unix system
  • fabpot/pimple
  • mongator/mongator

Installation

The recommended way to install Mongator/Silex is through composer. You can see the package information on Packagist., (*2)

{
    "require": {
        "mongator/pimple": "2.*"
    }
}

Parameters

  • mongator.connection.dsn (default 'mongodb://localhost:27017'): database connection string
  • mongator.connection.database: the database name
  • mongator.connection.name (default 'default'): the name of the connection
  • mongator.metadata.class: The metadata factory class name
  • mongator.logger (default null): instance of a logger class
  • mongator.cache.fields (default ArrayCache): instance of a mongator cache driver used in fields cache
  • mongator.cache.data (default ArrayCache): instance of a mongator cache driver used in data cache
  • mongator.extensions (default Array()): array of extension instances
  • mongator.models.output: output path of the classes
  • mongator.classes.config (default Array()): The config classes contain the information of the classes
  • mongator.classes.yaml.path: A valid dir with YAML definitions of the config classes

Registrating

$app->register(new Mongator\Pimple\MondatorServiceProvider());
$app->register(new Mongator\Pimple\MongatorServiceProvider(), array(
    'mongator.metadata.class' => 'Model\Mapping\Metadata',
    'mongator.models.output' => 'src/',
    'mongator.connection.database' => 'your_db'
));

Usage

use Symfony\Component\HttpFoundation\Response;

$app->post('/article', function ($id) use ($app) {
    $articleRepository = $app['mongator']->getRepository('Model\Article');
    $article = $articleRepository->findOneById($id);

    return new Response('', 201);
});

** Remember, before using the models you must generate them. (You can use the command provided with this package.) **, (*3)

Commands

With this package you can find three useful commands:, (*4)

  • mongator:generate: Processes config classes and generates the files of the classes.
  • mongator:indexes: Ensures the indexes of all repositories
  • mongator:fix: Fixes all the missing references.

You need the suggested package cilex/console-service-providerto use console commands on you Silex setup., (*5)

Tests

Tests are in the tests folder. To run them, you need PHPUnit. Example:, (*6)

$ phpunit --configuration phpunit.xml.dist

License

MIT, see LICENSE, (*7)

The Versions

21/05 2014

dev-master

9999999-dev

Provider to use Mongator with Pimple/Silex framework

  Sources   Download

MIT

The Requires

 

The Development Requires

21/05 2014

v2.0.0

2.0.0.0

Provider to use Mongator with Pimple/Silex framework

  Sources   Download

MIT

The Requires

 

The Development Requires