{"id":20236200,"url":"https://github.com/bakaphp/database","last_synced_at":"2025-04-10T19:01:53.247Z","repository":{"id":62491307,"uuid":"122409884","full_name":"bakaphp/database","owner":"bakaphp","description":"Wrapper for Phalcon Model that add behavior to work with Custom Fields (vertical tables)","archived":false,"fork":false,"pushed_at":"2020-09-09T14:50:01.000Z","size":100,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-24T16:43:36.942Z","etag":null,"topics":["database","mysql","phalcon-framework","phalcon-php","phalconphp"],"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/bakaphp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-22T00:08:46.000Z","updated_at":"2021-06-17T09:44:34.000Z","dependencies_parsed_at":"2022-11-02T11:03:52.503Z","dependency_job_id":null,"html_url":"https://github.com/bakaphp/database","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakaphp%2Fdatabase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakaphp%2Fdatabase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakaphp%2Fdatabase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakaphp%2Fdatabase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bakaphp","download_url":"https://codeload.github.com/bakaphp/database/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248278619,"owners_count":21077276,"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":["database","mysql","phalcon-framework","phalcon-php","phalconphp"],"created_at":"2024-11-14T08:19:30.474Z","updated_at":"2025-04-10T19:01:53.189Z","avatar_url":"https://github.com/bakaphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Baka Database\n\nBaka Database\n\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/bakaphp/database/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/bakaphp/database/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/bakaphp/database/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/bakaphp/database/?branch=master)\n[![Build Status](https://scrutinizer-ci.com/g/bakaphp/database/badges/build.png?b=master)](https://scrutinizer-ci.com/g/bakaphp/database/build-status/master)\n\n# Model\n\nThe default behavior of the baka model is giving you the normal functions to work with any mc project\n\n- automatic updated_at , created_at  times\n- soft delete by just calling softDelete() insted of delete()\n- toFullArray() instead of toArray() to avoid dynamic fields on your model been removed by phalcon serialization\n- Custom Fields Trait and CLI\n- Hash Table Traits for dynamic atributes \n\n# Custom Fields Model\n\nOne of the things we look for is a table that growth in a vertical way instead of horizontal . We made custom fields to avoid having to go later on in proyect and having to add new fields to the table, with this we can managed them dynamicly and later on add UI for the client to better manage the info\n\nTo create a custom fields table from a module you will need to use our CLI \n\nTo use you need your  model to extend from ModelCustomFields\n\n```php\n\u003c?php\n\nnamespace Canvas\\Models;\n\nclass Leads extends \\Baka\\Database\\Model\n{\n    use CustomFieldsTrait;\n}\n```\n\nAnd you also need to create the custom fields model value\n\n```php\n\u003c?php\n\nnamespace Canvas\\Models;\n\nuse \\Baka\\Database\\CustomeFieldsInterface;\n\nclass LeadsCustomFields extends \\Baka\\Database\\Model implements CustomeFieldsInterface\n{\n   /**\n     * Set the custom primary field id\n     *\n     * @param int $id\n     */\n    public function setCustomId(int $id)\n    {\n        $this-\u003eleads_id = $id;\n    }\n}\n```\n\nThats it now you can use this custom fields model like any other, no other explication is needed they will work like any phalcon normal model\n\n# Hash Tables\n\nLike its name implies, you have a table with key value for any entity you desire. This is usefull when you need to add settings to any tables in your system\n\n```php\n\u003c?php\n\nnamespace Canvas\\Models;\n\nclass Leads extends \\Baka\\Database\\Model\n{\n    use HashTableTrait;\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbakaphp%2Fdatabase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbakaphp%2Fdatabase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbakaphp%2Fdatabase/lists"}