Download the PHP package pomm/pomm-bundle without Composer

On this page you can find all versions of the php package pomm/pomm-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pomm-bundle


PommBundle a non ORM for Symfony2

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

PommBundle makes you able to benefit from `Pomm <http://pomm.coolkeums.org>` and `Postgres <http://postgresql.org>` features from your `Symfony2 <http://www.symfony.com>` 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

There are several ways to install PommBundle:

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

To use PommBundle, you can clone or download the bundle and the 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

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

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

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

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.


All versions of pomm-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
pomm/pomm Version ~1.2.0
symfony/framework-bundle Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pomm/pomm-bundle contains the following files

Loading the files please wait ....