{"id":28754303,"url":"https://github.com/zeroasterisk/cakephp-unionizable","last_synced_at":"2025-06-17T01:08:47.238Z","repository":{"id":23416657,"uuid":"26779297","full_name":"zeroasterisk/CakePHP-Unionizable","owner":"zeroasterisk","description":"Behavior to manage SELECT UNION finds with CakePHP","archived":false,"fork":false,"pushed_at":"2014-11-17T22:02:05.000Z","size":132,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2023-03-11T05:08:02.194Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zeroasterisk.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-11-17T21:58:44.000Z","updated_at":"2015-04-07T17:55:34.000Z","dependencies_parsed_at":"2022-07-25T10:01:57.993Z","dependency_job_id":null,"html_url":"https://github.com/zeroasterisk/CakePHP-Unionizable","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/zeroasterisk/CakePHP-Unionizable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroasterisk%2FCakePHP-Unionizable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroasterisk%2FCakePHP-Unionizable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroasterisk%2FCakePHP-Unionizable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroasterisk%2FCakePHP-Unionizable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeroasterisk","download_url":"https://codeload.github.com/zeroasterisk/CakePHP-Unionizable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroasterisk%2FCakePHP-Unionizable/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260269462,"owners_count":22983647,"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":"2025-06-17T01:08:20.195Z","updated_at":"2025-06-17T01:08:47.226Z","avatar_url":"https://github.com/zeroasterisk.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# basic UNION support for CakePHP\n\n`Model-\u003efind()` replacement for UNIONed queries\n\nSometimes you can not simply use an `OR` due to database performance reasons\n*(whole table scanning, ALL type in explain, etc.)*.\n\nSo you might need to break the query into multiple `UNION` based selects.\n\nThis is not something CakePHP supports.\n\nSo this Plugin attempts to let you use the rest of your Cake find\nfunctionality and only have to use the `UNION` when you need to.\n\n## Install\n\n    git submodule add https://github.com/zeroasterisk/CakePHP-Unionizable.git app/Plugin/Unionize\n    echo \"CakePlugin::load('Unionize', array('bootstrap' =\u003e false, 'routes' =\u003e false));\" \u003e\u003e app/Config/bootstrap.php\n\n## Usage: set conditions, find\n\n```\n$Model-\u003eunionizeSetConditions(['MyModel.myfield' =\u003e 'foobar']);\n$Model-\u003eunionizeSetConditions(['SomeOtherModel.someField' =\u003e 'foobar']);\n$results = $Model-\u003eunionizeFind('all', ['limit' =\u003e 2, 'order' =\u003e false]);\n```\n\nsupported find types:\n\n* 'all'\n* 'count' = 'count-real'\n* 'count-real' = excludes duplicate records (so A + A + B = 2)\n* 'count-fast' = included duplicate records (so A + A + B = 3)\n\n## TODO:\n\n* implement\n  [paginate](http://book.cakephp.org/2.0/en/core-libraries/components/pagination.html)\n  behavior hooks (if we have conditions set)\n* translate all fields to aliases and back (which gives us full sort support)\n* any way to make the find \"type\" work?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroasterisk%2Fcakephp-unionizable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeroasterisk%2Fcakephp-unionizable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroasterisk%2Fcakephp-unionizable/lists"}