{"id":22021588,"url":"https://github.com/lamansky/doctrine","last_synced_at":"2026-04-20T10:31:51.006Z","repository":{"id":57010865,"uuid":"288472064","full_name":"lamansky/doctrine","owner":"lamansky","description":"A collection of classes useful in almost any project that uses the Doctrine ORM.","archived":false,"fork":false,"pushed_at":"2022-03-21T20:32:25.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-03T10:09:42.630Z","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/lamansky.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-18T14:02:36.000Z","updated_at":"2022-03-21T19:21:31.000Z","dependencies_parsed_at":"2022-08-21T13:40:46.872Z","dependency_job_id":null,"html_url":"https://github.com/lamansky/doctrine","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/lamansky/doctrine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fdoctrine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fdoctrine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fdoctrine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fdoctrine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lamansky","download_url":"https://codeload.github.com/lamansky/doctrine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fdoctrine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32042966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-30T06:13:08.804Z","updated_at":"2026-04-20T10:31:50.988Z","avatar_url":"https://github.com/lamansky.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Doctrine Utilities\n\nA collection of utility classes for the [Doctrine](https://www.doctrine-project.org/projects/orm.html) ORM (Object Relational Mapper).\n\n## Installation\n\nWith [Composer](http://getcomposer.org) installed on your computer and initialized for your project, run this command in your project’s root directory:\n\n```bash\ncomposer require lamansky/doctrine\n```\n\nRequires PHP 7.4 or above.\n\nYou don’t need to install Doctrine2 separately. It will be bundled with this package.\n\n## Classes\n\nThe library contains two classes that are useful for almost any Doctrine project: `ProjectEntityManager` and `UTCDateTimeType`.\n\n### ProjectEntityManager\n\nAn abstract EntityManagerDecorator that automatically namespaces your Entity class names. To use, first create a class for your project that extends `ProjectEntityManager` and defines the class namespace prefixes:\n\n```php\n\u003c?php\nnamespace MyProject\\Doctrine;\nuse Lamansky\\Doctrine\\ProjectEntityManager;\n\nclass EntityManager extends ProjectEntityManager {\n    protected function getEntityNamespacePrefix () : string {\n        return 'MyProject\\Model\\Entity\\\\';\n    }\n\n    protected function getProxyNamespacePrefix () : string {\n        return 'MyProject\\Model\\Proxy\\\\';\n    }\n}\n```\n\nThen, initialize your entity manager like this:\n\n```php\n\u003c?php\nuse MyProject\\Doctrine\\EntityManager;\n\nglobal $em;\n\n$em = new EntityManager(\n    DB_HOST,\n    DB_USER,\n    DB_PASS,\n    DB_NAME,\n    IS_DEV_ENV, // This should be true or false.\n    __DIR__ . '/Model/Entity', // This is the path to your Entity class files directory.\n    __DIR__ . '/Model/Proxy' // This is the directory path in which generated Proxy class files should be stored.\n);\n```\n\n### UTCDateTimeType\n\nEnsures that all datetimes are converted to the UTC timezone when being stored in the database and are converted back to the server’s local timezone when being retrieved. Returns [Carbon](https://carbon.nesbot.com/) objects instead of built-in `DateTime` objects.\n\nJust use this code to override the built-in datetime types:\n\n```php\n\u003c?php\nuse Doctrine\\DBAL\\Types\\Type;\n\nType::overrideType('datetime', 'Lamansky\\Doctrine\\UTCDateTimeType');\nType::overrideType('datetimetz', 'Lamansky\\Doctrine\\UTCDateTimeType');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamansky%2Fdoctrine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flamansky%2Fdoctrine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamansky%2Fdoctrine/lists"}