{"id":19857971,"url":"https://github.com/boldare/xsolve-model-factory-bundle","last_synced_at":"2025-09-05T01:42:49.123Z","repository":{"id":46707054,"uuid":"65937953","full_name":"boldare/xsolve-model-factory-bundle","owner":"boldare","description":"This bundle provides a versatile skeleton for organizing model factories.","archived":false,"fork":false,"pushed_at":"2023-01-25T15:48:50.000Z","size":56,"stargazers_count":13,"open_issues_count":2,"forks_count":7,"subscribers_count":58,"default_branch":"master","last_synced_at":"2025-04-23T00:06:10.937Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/boldare.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":"2016-08-17T20:01:48.000Z","updated_at":"2023-01-25T15:45:23.000Z","dependencies_parsed_at":"2023-02-14T09:02:07.112Z","dependency_job_id":null,"html_url":"https://github.com/boldare/xsolve-model-factory-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/boldare%2Fxsolve-model-factory-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boldare%2Fxsolve-model-factory-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boldare%2Fxsolve-model-factory-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boldare%2Fxsolve-model-factory-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boldare","download_url":"https://codeload.github.com/boldare/xsolve-model-factory-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251972432,"owners_count":21673602,"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-12T14:20:34.025Z","updated_at":"2025-05-02T02:30:43.498Z","avatar_url":"https://github.com/boldare.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/xsolve-pl/xsolve-model-factory-bundle.svg?branch=master)](https://travis-ci.org/xsolve-pl/xsolve-model-factory-bundle)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/xsolve-pl/xsolve-model-factory-bundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/xsolve-pl/xsolve-model-factory-bundle/?branch=master)\n[![Latest Stable Version](https://poser.pugx.org/xsolve-pl/model-factory-bundle/v/stable)](https://packagist.org/packages/xsolve-pl/model-factory-bundle)\n[![Total Downloads](https://poser.pugx.org/xsolve-pl/model-factory-bundle/downloads)](https://packagist.org/packages/xsolve-pl/model-factory-bundle)\n[![Monthly Downloads](https://poser.pugx.org/xsolve-pl/model-factory-bundle/d/monthly)](https://packagist.org/packages/xsolve-pl/model-factory-bundle)\n[![License](https://poser.pugx.org/xsolve-pl/model-factory-bundle/license)](https://packagist.org/packages/xsolve-pl/model-factory-bundle)\n\nTable of contents\n=================\n\n  * [Introduction](#introduction)\n  * [License](#license)\n  * [Getting started](#getting-started)\n  * [Usage examples](#usage-examples)\n    * [Grouping model factories into collections](#grouping-model-factories-into-collections)\n\nIntroduction\n============\n\nThis bundle wraps [xsolve-pl/model-factory](https://packagist.org/packages/xsolve-pl/model-factory)\nlibrary and allows to compose collections of model factories declared as services\nwith the use of tags.\n\nSee the library documentation for more details on specific use cases.\n\nLicense\n=======\n\nThis bundle is under the MIT license. See the complete license in `LICENSE` file.\n\nGetting started\n===============\n\nInclude this bundle in your Symfony project using Composer as follows\n(assuming it is installed globally):\n\n```bash\n$ composer require xsolve-pl/model-factory-bundle\n```\n\nFor more information on Composer see its\n[Introduction](https://getcomposer.org/doc/00-intro.md).\n\nAfterwards you need to enable this bundle by adding a line to `app/AppKernel.php`\nfile of your project:\n\n```php\n\u003c?php\n// app/AppKernel.php\n\n// ...\nclass AppKernel extends Kernel\n{\n    public function registerBundles()\n    {\n        $bundles = array(\n            // ...\n            new Xsolve\\ModelFactoryBundle\\XsolveModelFactoryBundle(),\n        );\n\n        // ...\n    }\n}\n```\n\nThat's all - now you're ready to go!\n\n\nUsage example\n=============\n\nGrouping model factories into collections\n-----------------------------------------\n\nTo make it easy to produce models for multiple objects it is possible to\ngroup model factories into collections. If your application provides multiple\nAPIs (or multiple API versions that are so different that they utilize\ncompletely different models) you are able to group factories in separate\ncollections and avoid the risk of producing incorrect models.\n\nGrouping model factories into collections is made easier by providing\na dedicated compiler pass that uses tags on model factory service definitions\nto inject them into appropriate collections. Consider following example of\n`services.xml` file:\n\n```xml\n\u003c?xml version=\"1.0\" ?\u003e\n\n\u003ccontainer xmlns=\"http://symfony.com/schema/dic/services\"\n           xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n           xsi:schemaLocation=\"http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd\"\u003e\n\n    \u003cservices\u003e\n\n        \u003cservice id=\"example.model_factory_collection.first\"\n                 class=\"Xsolve\\ModelFactoryBundle\\ModelFactoryCollection\\ModelFactoryCollection\"\n        /\u003e\n\n        \u003cservice id=\"example.model_factory_collection.second\"\n                 class=\"Xsolve\\ModelFactoryBundle\\ModelFactoryCollection\\ModelFactoryCollection\"\n        /\u003e\n\n        \u003cservice id=\"example.model_factory.foo\"\n                 class=\"Example\\FooModelFactory\"\n        \u003e\n            \u003ctag name=\"xsolve.model_factory_bundle.model_factory\"\n                 model-factory-collection-id=\"example.model_factory_collection.first\"\n            /\u003e\n            \u003ctag name=\"xsolve.model_factory_bundle.model_factory\"\n                 model-factory-collection-id=\"example.model_factory_collection.second\"\n            /\u003e\n        \u003c/service\u003e\n\n    \u003c/services\u003e\n\n\u003c/container\u003e\n```\n\nThis snippet defines two model factory collections (with ids\n`example.model_factory_collection.first` and\n`example.model_factory_collection.second` respectively). It also defines a\nsingle model factory (with id `example.model_factory.foo`). This service has a\ntag assigned with `name` attribute equal\n`xsolve.model_factory_bundle.model_factory` (which will result in it being\nprocessed by\n`Xsolve\\ModelFactoryBundle\\DependencyInjection\\CompilerPass\\ModelFactoryCollectionCompilerPass`)\nand `model-factory-collection-id` attribute containing service ids of\nrespective collections.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboldare%2Fxsolve-model-factory-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboldare%2Fxsolve-model-factory-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboldare%2Fxsolve-model-factory-bundle/lists"}