{"id":20562879,"url":"https://github.com/cathedralcode/db","last_synced_at":"2025-07-15T17:34:01.529Z","repository":{"id":62500077,"uuid":"434606363","full_name":"CathedralCode/db","owner":"CathedralCode","description":"Database Layer interfaces and classes (runtime).","archived":false,"fork":false,"pushed_at":"2023-05-25T20:22:31.000Z","size":87,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-05-06T17:48:31.708Z","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":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CathedralCode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":"code_of_conduct.md","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":"2021-12-03T13:28:56.000Z","updated_at":"2021-12-03T13:31:27.000Z","dependencies_parsed_at":"2025-01-16T19:33:01.654Z","dependency_job_id":"edef36fe-277c-4ea3-9377-112ffdb03c67","html_url":"https://github.com/CathedralCode/db","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/CathedralCode/db","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CathedralCode%2Fdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CathedralCode%2Fdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CathedralCode%2Fdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CathedralCode%2Fdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CathedralCode","download_url":"https://codeload.github.com/CathedralCode/db/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CathedralCode%2Fdb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265450404,"owners_count":23767614,"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-16T04:14:51.371Z","updated_at":"2025-07-15T17:34:01.473Z","avatar_url":"https://github.com/CathedralCode.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cathedral\\Db\n\n\u003e $Id$ ($Date$)\n\nDatabase class for use with builder and its generated code.\n\n## Custom methods\n\nThere are a few custom methods you can create to easily modify your data before sending it to client.\n\n- customQueryOptions\n  - runs prior to data access\n  - lets you modify where clauses\n  - check query string values\n- customResponseOptions\n  - runs last, just prior to sending data\n  - has full access to the json response object\n- getListPost\n  - runs after data fetched from db\n- createPre\n  - check data before db record gets created\n\n\n```php\n/**\n * Gets the query string parameters for pagination\n *\n * @param array $options\n * @param array $params\n *\n * @return void\n */\npublic function customQueryOptions(\u0026$options, $params): void {\n    if (isset($params['fk_champions'])) $options['where']['fk_champions'] = intval($params['fk_champions']);\n}\n\n/**\n * Gets the query string parameters for pagination\n *\n * @param mixed $json\n * @return void\n */\npublic function customResponseOptions(\u0026$json): void {\n    /** @var JsonModel $json */\n    $payload = $json-\u003egetVariable('payload');\n\n    for ($i = 0; $i \u003c \\count($payload); $i++) $payload[$i]['champion'] = $this-\u003e_champions[$payload[$i]['fk_champions']];\n\n    $json-\u003esetVariable('extra', ['champions' =\u003e $this-\u003e_champions]);\n    $json-\u003esetVariable('payload', $payload);\n}\n\n/**\n * Modify the resultset\n *\n * @param mixed $data\n * @return void\n */\npublic function getListPost($data): void {\n    $data-\u003ebuffer();\n    foreach($data as $d) $this-\u003e_champions[$d-\u003eChampion()-\u003eid] = $d-\u003eChampion()-\u003ename;\n}\n\n/**\n * Check data before creating record\n *\n * @param mixed $data\n * @return null|string error\n */\npublic function createPre(\u0026$data): ?string {\n    // check data\n    return null;\n}\n    ```\n\n## Auth configurations\n\n...\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcathedralcode%2Fdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcathedralcode%2Fdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcathedralcode%2Fdb/lists"}