dev-master
9999999-devProvider to use Mongator with Pimple/Silex framework
MIT
The Requires
The Development Requires
v2.0.0
2.0.0.0Provider to use Mongator with Pimple/Silex framework
MIT
The Requires
The Development Requires
Wallogit.com
2017 © Pedro PelĂĄez
Provider to use Mongator with Pimple/Silex framework
Provider for using Mongator with Pimple/Silex framework, (*1)
The recommended way to install Mongator/Silex is through composer. You can see the package information on Packagist., (*2)
{
"require": {
"mongator/pimple": "2.*"
}
}
mongator.connection.dsn (default 'mongodb://localhost:27017'): database connection stringmongator.connection.database: the database namemongator.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 classmongator.cache.fields (default ArrayCache): instance of a mongator cache driver used in fields cachemongator.cache.data (default ArrayCache): instance of a mongator cache driver used in data cachemongator.extensions (default Array()): array of extension instances mongator.models.output: output path of the classesmongator.classes.config (default Array()): The config classes contain the information of the classesmongator.classes.yaml.path: A valid dir with YAML definitions of the config classes$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'
));
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)
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 repositoriesmongator:fix: Fixes all the missing references.You need the suggested package cilex/console-service-providerto use console commands on you Silex setup., (*5)
Tests are in the tests folder.
To run them, you need PHPUnit.
Example:, (*6)
$ phpunit --configuration phpunit.xml.dist
MIT, see LICENSE, (*7)
Provider to use Mongator with Pimple/Silex framework
MIT
Provider to use Mongator with Pimple/Silex framework
MIT