{"id":37365695,"url":"https://github.com/dorofey/depository","last_synced_at":"2026-01-16T04:51:15.118Z","repository":{"id":56971285,"uuid":"107658990","full_name":"dorofey/depository","owner":"dorofey","description":"ZF-3 Data mapper module","archived":false,"fork":false,"pushed_at":"2017-11-26T19:36:49.000Z","size":37,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-14T14:46:44.899Z","etag":null,"topics":["datamapper","mapper"],"latest_commit_sha":null,"homepage":"","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/dorofey.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":"2017-10-20T09:28:36.000Z","updated_at":"2019-06-04T07:50:37.000Z","dependencies_parsed_at":"2022-08-21T11:20:18.032Z","dependency_job_id":null,"html_url":"https://github.com/dorofey/depository","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/dorofey/depository","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dorofey%2Fdepository","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dorofey%2Fdepository/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dorofey%2Fdepository/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dorofey%2Fdepository/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dorofey","download_url":"https://codeload.github.com/dorofey/depository/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dorofey%2Fdepository/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28477210,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T03:13:13.607Z","status":"ssl_error","status_checked_at":"2026-01-16T03:11:47.863Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["datamapper","mapper"],"created_at":"2026-01-16T04:51:14.352Z","updated_at":"2026-01-16T04:51:15.113Z","avatar_url":"https://github.com/dorofey.png","language":"PHP","readme":"# ZF-3 Data mapper module\n\nSimple Data Mapper implementation based on `zend-db`  \nThis is not just work in progress, but beginning of work in progress. Don't even think about using it.\n\n\n## Example:\n    \n### Define our Post model\nEntityInterface defines getter and setter for id, nothing more.\n \n```php\nclass Post implements EntityInterface\n{\n    public $id;\n    public $user;\n    public $title;\n\n\n    public function setId($id)\n    ...\n    public function getId()\n    ...\n}\n```\n    \n### Define our mapper\n    \n```php\nclass PostMapper extends Repository\\Mapper\\StandardMapper\n{\n    protected static $entityClass = Post::class;\n    protected static $table = 'posts';\n\n    protected static $features = [\n        Repository\\Mapper\\Feature\\Relations::class =\u003e [\n            'user' =\u003e [Repository\\Hydrator\\HasOne::class, User::class]\n        ]\n    ];\n}\n```\n    \n### Add stuff in configuration\n\n```php\n[\n    'mappers' =\u003e [\n        'maps' =\u003e [\n            Post::class =\u003e PostMapper::class\n        ],\n        'aliases' =\u003e [\n            'posts' =\u003e Post::class\n        ]\n    ]\n]\n```\n    \n### In your code\n    \n```php\n$repository = $serviceLocator-\u003eget(\\Repository\\Repository\\RepositoryPluginManager::class);\n$mapper = $repository-\u003eget(Post::class);\n\n$singlePost = $mapper-\u003eid(10);\n$allPosts   = $mapper-\u003efetch();\n$somePosts  = $mapper-\u003efetch(['title' =\u003e 'My post title']);\n\n$somePosts  = $mapper-\u003efetch(function(Select $select){\n    $select-\u003ewhere(['title' =\u003e 'My post title'])-\u003eorder('cteated_at')-\u003elimit(2);\n});\n```\n    \n## Features\n\n### \\Repository\\Mapper\\Feature\\SoftDelete\n\nEnables \"soft-delete\" feature. Exposes `recover` method\n\n```php\n// In your mapper\nprotected static $features = [\n    Repository\\Mapper\\Feature\\SoftDelete::class =\u003e 'deleted_at' // default field is 'deleted_at'\n];\n....\n\n$post = $mapper-\u003eid(10);\n$mapper-\u003edelete($post);\n\n$mapper-\u003erecover($post);\n```\n\n### \\Repository\\Mapper\\Feature\\Timestamps\n\nEnables created and updated fields\n\n```php\n// In your mapper\nprotected static $features = [\n    Repository\\Mapper\\Feature\\Timestamps::class =\u003e ['created_at', 'updated_at']\n];\n....\n```\n\n### \\Repository\\Mapper\\Feature\\Transaction\n\n```php\n// In your mapper\nprotected static $features = [\n    Repository\\Mapper\\Feature\\Transaction::class,\n];\n....\n\n$mapper-\u003ewithTransaction();\n\n$mapper-\u003eupdate($post1);\n$mapper-\u003eupdate($post2);\n$mapper-\u003einsert($post3);\n$mapper-\u003edelete($post4);\n\n$mapper-\u003ecommitTransaction();\n```\n\n### \\Repository\\Mapper\\Feature\\Relations\n\n```php\n// In your mapper\nprotected static $features = [\n    Repository\\Mapper\\Feature\\Relations::class =\u003e [\n        'users'  =\u003e [HasManyThrough::class, User::class, ['post', 'user'], 'post_users'],\n        'author' =\u003e [HasOne::class, User::class],\n    ],\n];\n....\n\n$post = $mapper-\u003ewithRelation(['users', 'author])-\u003eid(10);\n$post-\u003eauthor-\u003ename;\n```\n\n### \\Repository\\Mapper\\Feature\\SelectStrategy (Work in progress)\n\nLets you define custom query logic or hide implementation details.  \nWould be useful if you're going to expose mappers to a ViewHelper or anything monkey would have access too.\n\n```php\n// In your mapper\nprotected static $features = [\n    Repository\\Mapper\\Feature\\SelectStrategy::class,\n];\n....\n\n$post = $mapper-\u003ewithStrategy(['limit' =\u003e 10, 'where' =\u003e 'author=2,age\u003c55', 'order' =\u003e '-created_at'])-\u003efetch();\n// Or simply\n$post = $mapper-\u003efetchWithStrategy(['limit' =\u003e 10, 'where' =\u003e 'author=2,age\u003c55']);\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdorofey%2Fdepository","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdorofey%2Fdepository","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdorofey%2Fdepository/lists"}