PHPackages                             pomm/pomm-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. pomm/pomm-bundle

ActiveLibrary[Database &amp; ORM](/categories/database)

pomm/pomm-bundle
================

The Symfony2 bundle for Postgresql Object Model Manager

1.2.0(11y ago)3030.3k9[2 issues](https://github.com/chanmix51/PommBundle/issues)1MITPHPPHP &gt;=5.3.0

Since Oct 15Pushed 10y ago5 watchersCompare

[ Source](https://github.com/chanmix51/PommBundle)[ Packagist](https://packagist.org/packages/pomm/pomm-bundle)[ Docs](http://pomm.coolkeums.org)[ RSS](/packages/pomm-pomm-bundle/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (3)Versions (4)Used By (1)

PommBundle a non ORM for Symfony2
=================================

[](#pommbundle-a-non-orm-for-symfony2)

What is PommBundle (for Pomm 1.x Only)?
---------------------------------------

[](#what-is-pommbundle-for-pomm-1x-only)

PommBundle makes you able to benefit from Pomm &lt;&gt; and Postgres &lt;&gt; features from your Symfony2 &lt;&gt; development.

Note:

```
This bundle is only useful if you are using old version of Pomm 1.x. For other later versions please
use the other bundle `pomm-project/pomm-bundle`.
```

Installation
------------

[](#installation)

There are several ways to install PommBundle:

> - Use Composer &lt;&gt;.
> - Clone github repo or download PommBundle's files in a directory.

### The composer way

[](#the-composer-way)

Just add the following line to your composer.json file:

```
{
    "minimum-stability": "dev",
    "require": {
        "pomm/pomm-bundle": "dev-master"
    }
}
```

And launch composer.phar install to get the bundle in the vendor directory with the autoloader set. If you are using Symfony 2.0.x, you may still be using sf2 autoloader. Update your app/autoload.php file:

```
$loader->registerNamespaces(array(
    'Symfony'          => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'),
    ...

    'Pomm'             => __DIR__.'/../vendor/pomm/pomm',
    'Pomm\\PommBundle' => __DIR__.'/../vendor/pomm/pomm-bundle',
```

### Download the files

[](#download-the-files)

To use PommBundle, you can clone or download the [bundle](https://github.com/chanmix51/PommBundle) and the [Pomm](https://github.com/chanmix51/Pomm) API in the *vendor* directory.

```
$ mkdir -p vendor/pomm/{pomm,pomm-bundle/Pomm/PommBundle}
$ git clone https://github.com/chanmix51/Pomm vendor/pomm/pomm
...
$ git clone https://github.com/chanmix51/PommBundle vendor/pomm/pomm-bundle/Pomm/PommBundle
```

You have now to tell Symfony2 autoloader where to find the API and the files that will be generated. Fire up your text editor and add the following lines to the *app/autoload.php* file:

```
#app/autoload.php

    'Pomm/PommBundle'                => __DIR__.'/../vendor/bundles/Pomm',
    'Pomm'                           => __DIR__.'/../vendor/pomm',
# This is the default namespace for the model
# But it can be changed see the command line tools
    'Model'                          => __DIR__.'/..',
```

Setup
-----

[](#setup)

Let's register the PommBundle in the application kernel:

```
#app/AppKernel.php
        // register your bundles
        new Pomm\PommBundle\PommBundle(),
```

You can now define your database settings in your main configuration file. The example below uses the yaml format:

```
# app/config/config.yml
pomm:
    databases:
        cnct_name:
            dsn: pgsql://user:password@host:port/dbname
```

The *cnct\_name* here is a name for your database. You can define several databases using different dsn or options.

```
#app/config/config.yml
pomm:
    databases:
        con1:
            dsn:       pgsql://user:password@host:port/dbname
        con2:
            dsn:       pgsql://user:password@host:port/dbname
            class:     My/Database    # default: Pomm\Connection\Database
            isolation: SERIALIZABLE
```

Now, you can configure the security layer to authenticate users:

```
#app/config/security.yml
security:
    providers:
        main:
            pomm:
                class: Acme\DemoBundle\Model\User
                property: email
                database: con1
```

Your User model must implement UserInterface

```
#src/Acme/DemoBundle/Model/User.php
namespace Acme\DemoBundle\Model;

use Pomm\Object\BaseObject;
use Symfony\Component\Security\Core\User\UserInterface;

class User extends BaseObject implements UserInterface
{
    public function getRoles()
    {
        return $this->get('roles');
    }

    public function getPassword()
    {
        return $this->get('password');
    }

    public function getSalt()
    {
        return $this->get('salt');
    }

    public function getUsername()
    {
        return $this->get('email');
    }

    public function eraseCredentials()
    {
    }
}
```

How to register converters
--------------------------

[](#how-to-register-converters)

You can define global converter definitions for all databases, and/or per database:

```
#app/config/config.yml
pomm:
    converters:
        year:
            class: My\Pomm\Converter\Year
            types: [year]
        month:
            class: My\Pomm\Converter\Month
            types: [month]
    databases:
        con1:
            dsn:       pgsql://user:password@host:port/dbname
            converters:
                day:
                    class: My\Pomm\Converter\Day
                    types: [day]
        con2:
            dsn:       pgsql://user:password@host:port/dbname
            class:     My/Database    # default: Pomm\Connection\Database
            isolation: SERIALIZABLE
```

The con1 database will have the year, month and day converters. The con2 database will have the year and month converters.

How to generate Map files
-------------------------

[](#how-to-generate-map-files)

A Map file is the way for Pomm to know about your tables structures. Pomm can scan the database to generate these files for you.

```
$ app/console pomm:mapfile:create my_table
```

This will create a file *Model/Pomm/Entity/Public/Base/MyTableMap.php* with the class *MyTableMap* in the namespace *Model\\Pomm\\Entity\\Public\\Base* extending Pomm\\Object\\BaseObjectMap that maps to the table *my\_table* in the postgresql's schema *public*. You can of course override any of these settings using the command line options:

```
$ app/console pomm:mapfile:create --database=foo --prefix-path=other/dir --prefix-namespace="Other\Namespace" --schema="other_schema" --extends="Other\\Parent" my_table
```

This will create a *other/dir/Model/Pomm/Entity/OtherSchema/Base/MyTableMap.php* file owning the *Other\\Namespace\\Model\\Pomm\\Entity\\OtherSchema\\Base\\MyTableMap* class from the postgres table *other\_schema.my\_table* according to the database defined as *foo* in the configuration. This can be useful if you want to store the model files in your bundles instead having them in the project directory.

Of course a

```
$ app/console help pomm:mapfile:create
```

will help you :)

Real life projects have dozens (sometimes hundreds) tables and it could be tiedous to generate map files one by one. Pomm has a command to scan Postgresql'schemas for tables and generate all the corresponding Map files.

```
$ app/console pomm:mapfile:scan
```

All previous options also apply for this command.

Examples
--------

[](#examples)

In your controllers, using the default database (the first defined):

```
public function listThingsAction()
{
    $things = $this->get('pomm')
        ->getDatabase()
        ->getConnection()
        ->getMapFor('Model\Pomm\Entity\NssBlog\Article')
        ->findAll();

        ...
}
```

You might want to filter things with some conditions:

```
public function listActiveAndRecentThingsAction()
{
    $things = $this->get('pomm')
        ->getDatabase()
        ->getConnection()
        ->getMapFor('Model\Pomm\Entity\NssBlog\Article')
        ->findWhere('active AND created_at > ?', array(strtotime('one month ago')));

        ...
}
```

Another example calling a custom model function from a database named *foo*:

```
public function myListStuffAction()
{
    $stuff = $this->get('pomm')
        ->getDatabase('foo')
        ->getConnection()
        ->getMapFor('Model\Pomm\Entity\AdminUser\Group')
        ->myModelMethod();

        ...
}
```

Pomm also make you benefit from Postgresql's nice transaction mechanism, see the [Pomm's online documentation](http://www.pomm-project.org/documentation/manual-1.2).

>

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 69.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~288 days

Total

3

Last Release

4067d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ad548f45d6e5ef262a3fccb208a92f2e31d6e53b71e989ec49fb3c7fe03dd020?d=identicon)[chanmix51](/maintainers/chanmix51)

---

Top Contributors

[![chanmix51](https://avatars.githubusercontent.com/u/81580?v=4)](https://github.com/chanmix51 "chanmix51 (51 commits)")[![docteurklein](https://avatars.githubusercontent.com/u/109846?v=4)](https://github.com/docteurklein "docteurklein (4 commits)")[![adrienbrault](https://avatars.githubusercontent.com/u/611271?v=4)](https://github.com/adrienbrault "adrienbrault (4 commits)")[![xavierbriand](https://avatars.githubusercontent.com/u/135156?v=4)](https://github.com/xavierbriand "xavierbriand (3 commits)")[![kcivey](https://avatars.githubusercontent.com/u/61062?v=4)](https://github.com/kcivey "kcivey (2 commits)")[![krevindiou](https://avatars.githubusercontent.com/u/650852?v=4)](https://github.com/krevindiou "krevindiou (2 commits)")[![podhy](https://avatars.githubusercontent.com/u/4160145?v=4)](https://github.com/podhy "podhy (1 commits)")[![ronanguilloux](https://avatars.githubusercontent.com/u/313677?v=4)](https://github.com/ronanguilloux "ronanguilloux (1 commits)")[![sanpii](https://avatars.githubusercontent.com/u/113045?v=4)](https://github.com/sanpii "sanpii (1 commits)")[![webaaz](https://avatars.githubusercontent.com/u/489498?v=4)](https://github.com/webaaz "webaaz (1 commits)")[![eneault](https://avatars.githubusercontent.com/u/4147017?v=4)](https://github.com/eneault "eneault (1 commits)")[![cordoval](https://avatars.githubusercontent.com/u/328359?v=4)](https://github.com/cordoval "cordoval (1 commits)")[![Palleas](https://avatars.githubusercontent.com/u/48797?v=4)](https://github.com/Palleas "Palleas (1 commits)")

---

Tags

symfonydatabaseormpostgresql

### Embed Badge

![Health badge](/badges/pomm-pomm-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/pomm-pomm-bundle/health.svg)](https://phpackages.com/packages/pomm-pomm-bundle)
```

###  Alternatives

[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[pomm-project/pomm-bundle

The Symfony2 bundle for Pomm2

81201.3k4](/packages/pomm-project-pomm-bundle)[omines/datatables-bundle

Symfony DataTables Bundle with native Doctrine ORM, Elastica and MongoDB support

2841.5M6](/packages/omines-datatables-bundle)[goodwix/doctrine-json-odm

JSON Object-Document Mapping bundle for Symfony and Doctrine

2226.9k](/packages/goodwix-doctrine-json-odm)[ahmed-bhs/doctrine-doctor

Runtime analysis tool for Doctrine ORM integrated into Symfony Web Profiler. Unlike static linters, it analyzes actual query execution at runtime to detect performance bottlenecks, security vulnerabilities, and best practice violations during development with real execution context and data.

939.0k](/packages/ahmed-bhs-doctrine-doctor)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
