{"id":19961143,"url":"https://github.com/formapro/yadm-bundle","last_synced_at":"2025-05-03T22:30:41.238Z","repository":{"id":62506633,"uuid":"84218862","full_name":"formapro/yadm-bundle","owner":"formapro","description":"An efficient way to treat MongoDB in Symfony. Extremely fast persistence and hydration.","archived":false,"fork":false,"pushed_at":"2019-05-15T12:44:42.000Z","size":63,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-06T20:25:51.476Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/formapro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-07T16:02:15.000Z","updated_at":"2022-10-30T12:53:57.000Z","dependencies_parsed_at":"2022-11-02T12:31:00.912Z","dependency_job_id":null,"html_url":"https://github.com/formapro/yadm-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/formapro%2Fyadm-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formapro%2Fyadm-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formapro%2Fyadm-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formapro%2Fyadm-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/formapro","download_url":"https://codeload.github.com/formapro/yadm-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224374785,"owners_count":17300691,"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":[],"created_at":"2024-11-13T02:06:31.672Z","updated_at":"2024-11-13T02:06:32.304Z","avatar_url":"https://github.com/formapro.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YadmBundle\n\n## Install\n\nInstall library\n\n```bash\n$ composer require formapro/yadm-bundle \"mikemccabe/json-patch-php:dev-master as 0.1.1\"\n```\n\nRegister the bundle\n\n```php\n\u003c?php\n# /app/AppKernel.php\n\nclass AppKernel extends Kernel\n{\n    public function registerBundles()\n    {\n        $bundles = [\n            new \\Formapro\\Yadm\\Bundle\\YadmBundle(),\n        ];\n\n        return $bundles;\n    }\n}\n```\n\n## Configure\n\n```yaml\nyadm:\n    mongo_uri: 'mongodb://mongo:27017/db_name'\n    migrations: ~ # enable migrations\n    models:\n      category:\n          class: 'Acme\\Model\\Category'\n          collection: 'category'\n      product:\n          class: 'Acme\\Model\\Product'\n          collection: 'product'\n          hydrator: 'app.product.hydrator'\n```\n\n## Usage\n\nIn your code you can get the storage from registry:\n\n```php\n\u003c?php\n\n$registry = $container-\u003eget('yadm');\n\n$productStorage = $registry-\u003egetStorage('Acme\\Model\\Category');\n```\n\n## Migrations\n\nGenerate new migration class\n\n```bash\n$ ./bin/console yadm:migrations:generate\n  Generated new migration class to \"/app/YadmMigrations/Migration20190301122316.php\"\n```\n\nGenerated migration class example\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nnamespace App\\YadmMigrations;\n\nuse Formapro\\Yadm\\Migration\\Migration;\nuse Formapro\\Yadm\\Registry;\n\n/**\n * Auto-generated Migration: Please modify to your needs!\n */\nfinal class Migration20190301122316 implements Migration\n{\n    public function execute(Registry $yadm): void\n    {\n\n    }\n}\n```\n\nExecute migrations\n\n```bash\n$ ./bin/console yadm:migrations:migrate\n  Next migrations will be executed: 20190301122316, 20190301122500, 20190301122502\n  WARNING! You are about to execute a database migration that could result in schema changes and data loss. Are you sure you wish to continue? (y/n)\n  Execute migration: 20190301122316\n  Execute migration: 20190301122500\n  Execute migration: 20190301122502\n  \n    ------------------------\n    ++ finished in 0s\n    ++ 3 migrations executed\n```\n\n\n## Licence\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fformapro%2Fyadm-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fformapro%2Fyadm-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fformapro%2Fyadm-bundle/lists"}