{"id":24397700,"url":"https://github.com/pomm-project/pomm-bundle","last_synced_at":"2025-04-06T08:14:10.508Z","repository":{"id":24680530,"uuid":"28091439","full_name":"pomm-project/pomm-bundle","owner":"pomm-project","description":"Pomm2 bundle for Symfony","archived":false,"fork":false,"pushed_at":"2022-02-25T08:16:46.000Z","size":168,"stargazers_count":81,"open_issues_count":10,"forks_count":31,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-30T06:06:45.008Z","etag":null,"topics":["database","php","pomm","postgres","postgresql","symfony"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pomm-project.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-16T14:49:04.000Z","updated_at":"2023-08-22T14:44:51.000Z","dependencies_parsed_at":"2022-07-14T00:30:41.965Z","dependency_job_id":null,"html_url":"https://github.com/pomm-project/pomm-bundle","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pomm-project%2Fpomm-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pomm-project%2Fpomm-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pomm-project%2Fpomm-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pomm-project%2Fpomm-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pomm-project","download_url":"https://codeload.github.com/pomm-project/pomm-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247451665,"owners_count":20940944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","php","pomm","postgres","postgresql","symfony"],"created_at":"2025-01-19T22:39:11.921Z","updated_at":"2025-04-06T08:14:10.484Z","avatar_url":"https://github.com/pomm-project.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pomm2 bundle for Symfony\n\n[![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)\n\nAlthough this bundle usable already, it is a work in progress. New features will be added.\n\nThis bundle provides a `pomm` service to use the Pomm2 [Model Manager](https://github.com/pomm-project/ModelManager) with Symfony.\n\n**Note:**\n\nIf you are looking for a bundle for Pomm 1.x then look up for `pomm/pomm-bundle` on packagist.\n\n## Installation\n\n```\ncomposer require pomm-project/pomm-bundle\n```\n\n**Note:**\n\nPomm bundle support\n[symfony flex](https://symfony.com/doc/current/setup/flex.html), the\n[recipe](https://github.com/symfony/recipes-contrib/tree/master/pomm-project/pomm-bundle/2.3)\nadd route for the profiler pannel and a minimal configuration with a `db` session\nloaded from `DATABASE_URL` environment variable.\n\n## Setup\n\nAdd the bundle in the `app/AppKernel.php` file:\n\n```php\n\u003c?php // app/AppKernel.php\n// …\n    public function registerBundles()\n    {\n        $bundles = [\n        // other bundles\n        new \\PommProject\\PommBundle\\PommBundle(),\n        // other bundles\n        ];\n```\n## Configuration\n\nIn the `app/config` folder, store your db connection parameters in `parameters.yml`:\n\n```yml\nparameters:\n    db_host1: 127.0.0.1\n    db_port1: 5432\n    db_name1: my_db_name\n    db_user1: user\n    db_password1: pass\n\n    db_host2: 127.0.0.1\n#   etc.\n```\n\nSensitive information such as database credentials should not be committed in Git. To help you prevent committing those files and folders by accident, the Symfony Standard Distribution comes with a file called .gitignore which list resources that Git should ignore, included this `parameters.yml` file.\nYou can now refer to these parameters elsewhere by surrounding them with percent (%).\n\nAdd an entry in `config.yml`:\n\n```yml\npomm:\n    configuration:\n        my_db1:\n            dsn: \"pgsql://%db_user1%:%db_password1%@%db_host1%:%db_port1%/%db_name1%\"\n            pomm:default: true\n        my_db2:\n            dsn: \"pgsql://%db_user2%:%db_password2%@%db_host2%:%db_port2%/%db_name2%\"\n            session_builder: \"pomm.session_builder\"\n    logger:\n        service: \"@logger\"\n```\n\nAnd in `routing_dev.yml`:\n\n```yml\n_pomm:\n    resource: \"@PommBundle/Resources/config/routing.yml\"\n    prefix:   /_pomm\n```\n\n## Command line interface\n\nThe [Pomm CLI](https://github.com/pomm-project/Cli) is available through the `bin/console` utility. It is possible to browse the database or to generate model files.\n\n```\n$ ./bin/console pomm:generate:relation-all -d src -a 'AppBundle\\Model' my_db1 student\n```\n\nIf you want generate schema, you need to use the model manager session builder:\n\n```yml\npomm:\n    configuration:\n        my_db1:\n            dsn: \"pgsql://%db_user1%:%db_password1%@%db_host1%:%db_port1%/%db_name1%\"\n            session_builder: \"pomm.model_manager.session_builder\"\n```\n\n## Using Pomm from the controller\n\nThe Pomm service is available in the DIC as any other service:\n\n```php\n    function myAction($name)\n    {\n        $students = $this-\u003eget('pomm')['my_db2']\n            -\u003egetModel('\\AppBundle\\Model\\MyDb1\\PublicSchema\\StudentModel')\n            -\u003efindWhere('name = $*', [$name])\n            ;\n\n        …\n```\n\nIt is now possible to tune and create a model layer as described in [the quick start guide](http://www.pomm-project.org/documentation/sandbox2).\n\n## Param converter\n\nThis bundle provide a [param\nconverter](http://symfony.com/doc/master/bundles/SensioFrameworkExtraBundle/annotations/converters.html)\nto convert request to a flexible entity. The converter search in the request the\nparameters with names matching primary key.\n\nYou can specify witch connexion use in the option:\n\n```php\n\n/**\n * @ParamConverter(\"student\", options={\"session\": \"my_db2\"})\n */\npublic function getAction(Student $student)\n```\n\nBy default, the model used for find the entity is deduce by adding ``Model`` to\nentity class name. If you have a different class name, you can use the ``model``\noption:\n\n```php\n\n/**\n * @ParamConverter(\"student\", options={\"model\": \"StudentModel\"})\n */\npublic function getAction(Student $student)\n```\n\nThis feature require\n[sensio/framework-extra-bundle](http://symfony.com/doc/master/bundles/SensioFrameworkExtraBundle/index.html).\n\n## Serializer\n\nYou can use the\n[serializer](https://symfony.com/doc/current/components/serializer.html)\ncomponent to serialize entities.\n\n## Property info\n\nThis bundle also provide [property\ninfo](https://symfony.com/doc/current/components/property_info.html) support to\nretrieve flexible entity properties informations.\n\n## Poolers as service\n\nIf you need to add additional poolers into the session builder all you need to do is tag a service definition with `pomm.pooler`\n\n## Model and Model layer as a service\n\nModel and model layer objects can be registered as a service.\nFor this to work properly you have to tag your service correctly and remove `class:session_builder` from configuration.\n\nModels must be tagged with `pomm.model` and layers with `pomm.model_layer`\n\nBoth of those tags have the following parameters:\n * `pooler` which is the name of a default pooler service, if left blank the default is used\n * `session` which is the name of a default session service this is used from, if left blank the default is used\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpomm-project%2Fpomm-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpomm-project%2Fpomm-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpomm-project%2Fpomm-bundle/lists"}