Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pomm-project/pomm-bundle
Pomm2 bundle for Symfony
https://github.com/pomm-project/pomm-bundle
database php pomm postgres postgresql symfony
Last synced: 1 day ago
JSON representation
Pomm2 bundle for Symfony
- Host: GitHub
- URL: https://github.com/pomm-project/pomm-bundle
- Owner: pomm-project
- Created: 2014-12-16T14:49:04.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2022-02-25T08:16:46.000Z (almost 3 years ago)
- Last Synced: 2025-01-10T12:55:02.256Z (11 days ago)
- Topics: database, php, pomm, postgres, postgresql, symfony
- Language: PHP
- Homepage:
- Size: 164 KB
- Stars: 81
- Watchers: 13
- Forks: 31
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pomm2 bundle for Symfony
[![Build Status](https://travis-ci.org/pomm-project/pomm-bundle.svg)](https://travis-ci.org/pomm-project/pomm-bundle) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/pomm-project/pomm-bundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/pomm-project/pomm-bundle/?branch=master)
Although this bundle usable already, it is a work in progress. New features will be added.
This bundle provides a `pomm` service to use the Pomm2 [Model Manager](https://github.com/pomm-project/ModelManager) with Symfony.
**Note:**
If you are looking for a bundle for Pomm 1.x then look up for `pomm/pomm-bundle` on packagist.
## Installation
```
composer require pomm-project/pomm-bundle
```**Note:**
Pomm bundle support
[symfony flex](https://symfony.com/doc/current/setup/flex.html), the
[recipe](https://github.com/symfony/recipes-contrib/tree/master/pomm-project/pomm-bundle/2.3)
add route for the profiler pannel and a minimal configuration with a `db` session
loaded from `DATABASE_URL` environment variable.## Setup
Add the bundle in the `app/AppKernel.php` file:
```php
get('pomm')['my_db2']
->getModel('\AppBundle\Model\MyDb1\PublicSchema\StudentModel')
->findWhere('name = $*', [$name])
;…
```It is now possible to tune and create a model layer as described in [the quick start guide](http://www.pomm-project.org/documentation/sandbox2).
## Param converter
This bundle provide a [param
converter](http://symfony.com/doc/master/bundles/SensioFrameworkExtraBundle/annotations/converters.html)
to convert request to a flexible entity. The converter search in the request the
parameters with names matching primary key.You can specify witch connexion use in the option:
```php
/**
* @ParamConverter("student", options={"session": "my_db2"})
*/
public function getAction(Student $student)
```By default, the model used for find the entity is deduce by adding ``Model`` to
entity class name. If you have a different class name, you can use the ``model``
option:```php
/**
* @ParamConverter("student", options={"model": "StudentModel"})
*/
public function getAction(Student $student)
```This feature require
[sensio/framework-extra-bundle](http://symfony.com/doc/master/bundles/SensioFrameworkExtraBundle/index.html).## Serializer
You can use the
[serializer](https://symfony.com/doc/current/components/serializer.html)
component to serialize entities.## Property info
This bundle also provide [property
info](https://symfony.com/doc/current/components/property_info.html) support to
retrieve flexible entity properties informations.## Poolers as service
If you need to add additional poolers into the session builder all you need to do is tag a service definition with `pomm.pooler`
## Model and Model layer as a service
Model and model layer objects can be registered as a service.
For this to work properly you have to tag your service correctly and remove `class:session_builder` from configuration.Models must be tagged with `pomm.model` and layers with `pomm.model_layer`
Both of those tags have the following parameters:
* `pooler` which is the name of a default pooler service, if left blank the default is used
* `session` which is the name of a default session service this is used from, if left blank the default is used