{"id":19606403,"url":"https://github.com/a2lix/symfony-collection","last_synced_at":"2025-04-05T19:12:43.649Z","repository":{"id":31708047,"uuid":"128662777","full_name":"a2lix/symfony-collection","owner":"a2lix","description":"Manage your Symfony collection simply with vanilla JS","archived":false,"fork":false,"pushed_at":"2025-02-11T00:03:17.000Z","size":40,"stargazers_count":43,"open_issues_count":3,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T18:08:41.867Z","etag":null,"topics":["collection","javascript","symfony","symfony-collection","symfony-form","typescript"],"latest_commit_sha":null,"homepage":"https://a2lix.fr","language":"TypeScript","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/a2lix.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-08T16:56:07.000Z","updated_at":"2024-02-02T13:31:55.000Z","dependencies_parsed_at":"2024-06-19T17:12:31.971Z","dependency_job_id":"1c06bb33-f304-4338-a389-15284436839a","html_url":"https://github.com/a2lix/symfony-collection","commit_stats":{"total_commits":23,"total_committers":4,"mean_commits":5.75,"dds":"0.17391304347826086","last_synced_commit":"824016d22d827c885dcb684c1ec02296d3e2bacd"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a2lix%2Fsymfony-collection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a2lix%2Fsymfony-collection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a2lix%2Fsymfony-collection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a2lix%2Fsymfony-collection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a2lix","download_url":"https://codeload.github.com/a2lix/symfony-collection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247386265,"owners_count":20930619,"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":["collection","javascript","symfony","symfony-collection","symfony-form","typescript"],"created_at":"2024-11-11T10:05:15.875Z","updated_at":"2025-04-05T19:12:43.618Z","avatar_url":"https://github.com/a2lix.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A2LiX JS - symfony-collection\n\nManage your Symfony Form collection simply with vanilla JS\n\n[![npm version](https://badge.fury.io/js/%40a2lix%2Fsymfony-collection.svg)](https://badge.fury.io/js/%40a2lix%2Fsymfony-collection)\n\n![image](https://user-images.githubusercontent.com/517753/210223130-e5af99fe-204e-4bd3-8b76-ba3ac4946fff.png)\n\n\n## Install\n\n```cmd\nnpm install @a2lix/symfony-collection\n```\n\n\n## Basic use\n\nSee Symfony Encore example (https://github.com/a2lix/Demo/blob/master/assets/app.js)\n\n```js\nimport a2lix_lib from '@a2lix/symfony-collection/dist/a2lix_sf_collection.min'\n\na2lix_lib.sfCollection.init()\n```\n\n## Advanced use\n\nDefault configuration https://github.com/a2lix/symfony-collection/blob/master/src/a2lix_sf_collection.ts#L3-L45\ncan be customized globally in javascript during init\n\n\n```js\na2lix_lib.sfCollection.init({\n  entry: {\n    add: {\n        label: 'Add entry'\n    },\n}}\n```\n\nOr/And more precisely on each collection by using DOM attributes:\n\n```php\n  ...\n    -\u003eadd('categories', CollectionType::class, [\n        ...\n        'attr' =\u003e [\n          'data-entry-add-label' =\u003e 'Add Category',\n        ],\n    ])\n```\n\n### Nested collection(s)\n\nAs advised by SF in this case, you must override the default 'prototype_name' option (https://symfony.com/doc/current/reference/forms/types/collection.html#prototype-name) of the nested collection with a custom name. Then, set this same custom name in a 'data-prototype-name' DOM attribute.\n\nExample of a 'tags' collection nested in a 'categories' collection:\n\n\n```php\n  ...\n    -\u003eadd('tags', CollectionType::class, [\n        'entry_type' =\u003e TextType::class,\n        'allow_add' =\u003e true,\n        'allow_delete' =\u003e true,\n        'delete_empty' =\u003e true,\n        'by_reference' =\u003e false,\n        'prototype_name' =\u003e '__name2__',  // Advised by Symfony\n        'attr' =\u003e [\n            'data-prototype-name' =\u003e '__name2__'  // Required by a2lix_sf_collection\n        ],\n        'entry_options' =\u003e [\n            'label' =\u003e false,\n        ],\n```\n\n\n## Contribute help\n\n```cmd\ndocker run -it --rm --user $(id -u):$(id -g) --name a2lix_nodejs -v \"$PWD\":/usr/src/app -w /usr/src/app node:alpine npm install\ndocker run -it --rm --user $(id -u):$(id -g) --name a2lix_nodejs -v \"$PWD\":/usr/src/app -w /usr/src/app node:alpine npm run build\n\n```\n\n\n# Demo\n\nSee [Demo project](https://github.com/a2lix/Demo).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa2lix%2Fsymfony-collection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa2lix%2Fsymfony-collection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa2lix%2Fsymfony-collection/lists"}