{"id":18773100,"url":"https://github.com/webfactory/webfactory-visibility-filter-bundle","last_synced_at":"2025-07-15T01:09:49.807Z","repository":{"id":40555221,"uuid":"357874462","full_name":"webfactory/webfactory-visibility-filter-bundle","owner":"webfactory","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-12T09:35:05.000Z","size":100,"stargazers_count":0,"open_issues_count":12,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-12T10:28:22.213Z","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/webfactory.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-14T11:06:32.000Z","updated_at":"2025-01-27T12:06:18.000Z","dependencies_parsed_at":"2024-06-07T12:01:34.388Z","dependency_job_id":"804b1e13-912e-40bd-ba1a-4173654b25b3","html_url":"https://github.com/webfactory/webfactory-visibility-filter-bundle","commit_stats":{"total_commits":81,"total_committers":5,"mean_commits":16.2,"dds":"0.13580246913580252","last_synced_commit":"93155648fbb8ed81c7ead78cbc45a0d3d0b56991"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/webfactory/webfactory-visibility-filter-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfactory%2Fwebfactory-visibility-filter-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfactory%2Fwebfactory-visibility-filter-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfactory%2Fwebfactory-visibility-filter-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfactory%2Fwebfactory-visibility-filter-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webfactory","download_url":"https://codeload.github.com/webfactory/webfactory-visibility-filter-bundle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfactory%2Fwebfactory-visibility-filter-bundle/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265383606,"owners_count":23756566,"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-07T19:32:46.344Z","updated_at":"2025-07-15T01:09:49.799Z","avatar_url":"https://github.com/webfactory.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VisibilityFilterBundle – A centralised approach to visibility of Doctrine Entities\n\nThis bundle provides a Doctrine Filter which handles visibility filtering for Entities transparently for a whole\napplication, removing the need to repeatedly phrase the filtering in every repository method of an Entity. Most notably,\nthe filtering also applies to Doctrine queries that bypass the repository, like relationships declared in the entity\nmapping.\n\n## Getting started\n\nFirst, you need to declare this bundle as a composer dependency.\n\n```shell\ncomposer require webfactory/visibility-filter-bundle\n```\n\nNext, the bundle needs to be registered to Symfony. Depending on your Symfony version, this might look like that:\n\n```php\n# src/bundles.php\n\nreturn [\n    # ...\n        Webfactory\\VisibilityFilterBundle\\VisibilityFilterBundle::class =\u003e ['all' =\u003e true],\n    # ...\n];\n```\n\nThe filter class needs to be registered manually.\n\n```yaml\n# src/config.yml\ndoctrine:\n    orm:\n        filters:\n            visibility: Webfactory\\VisibilityFilterBundle\\Filter\\VisibilityColumnConsideringSQLFilter\n```\n\nImportant: The YAML key of the filter needs to `visibility`, otherwise the filter won't be activated on requests.\n\n## Configuring the visibility column\n\nThis bundle assumes that the visibility determination is going to be based on a specific field in the Entity containing\nvisibility information; e.g. functioning as a \"visibility switch\" containing \"yes\" or \"no\" or containing a visibility\ngrade on a scale, based on which the visibility of the object will be determined.\n\n**Currently, only entities that have a visibility column configured will be filtered at all.**\n\nAll you need to configure on your entity is *which* of its fields will be the one with the visibility information.\nYou can do that by Adding the `VisibilityColumn` attribute to that field.\n\n```php\n\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Webfactory\\VisibilityFilterBundle\\Attribute\\VisibilityColumn;\n\n #[ORM\\Entity()]\nclass EntityWithVisibilityColumn\n{\n    // ...\n     #[ORM\\Column(type: \"string\")]\n     #[VisibilityColumn]\n    private string $visibilityColumn;\n    // ...\n}\n```\n\nPlease note that configuring more than one field as visibility column will throw an exception.\n\n## Replacing the filter strategy\n\nBy default, the library makes you application only query entities from the database that have the string `y` in their\nvisibility column. You can change this behaviour by overwriting the service\n`Webfactory\\VisibilityFilterBundle\\Filter\\FilterStrategy` with your own implementation.\n\nYour implementation needs to implement the `FilterStrategy` interface. If you only want to change the `y` string to\nsomething different, you can use the `Webfactory\\VisibilityFilterBundle\\Filter\\Strategy\\ValueInField` implementation\nand provide it with a different `visibleValue` in its constructor.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebfactory%2Fwebfactory-visibility-filter-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebfactory%2Fwebfactory-visibility-filter-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebfactory%2Fwebfactory-visibility-filter-bundle/lists"}