{"id":15080701,"url":"https://github.com/baraja-core/doctrine","last_synced_at":"2025-04-10T20:10:43.448Z","repository":{"id":48559869,"uuid":"196564725","full_name":"baraja-core/doctrine","owner":"baraja-core","description":"📚 Doctrine integration to Nette Framework. Simple interface, easy to use, best performance, top compatibility.","archived":false,"fork":false,"pushed_at":"2023-05-25T14:47:00.000Z","size":673,"stargazers_count":11,"open_issues_count":5,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-02T04:36:28.603Z","etag":null,"topics":["baraja","best-practices","czech-language","database","doctrine","doctrine-2","drivers","entity","nette","nette-database","nette-orm","orm","panel","php","php-database","php-orm","sql"],"latest_commit_sha":null,"homepage":"https://php.baraja.cz","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/baraja-core.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"LICENSE","code_of_conduct":null,"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},"funding":{"github":"janbarasek","custom":["https://brj.app","https://baraja.cz","https://php.baraja.cz"]}},"created_at":"2019-07-12T11:05:06.000Z","updated_at":"2024-06-09T21:31:45.786Z","dependencies_parsed_at":"2024-06-09T21:31:42.153Z","dependency_job_id":"e9e2d72b-f126-435f-b0b9-2bf187c953dc","html_url":"https://github.com/baraja-core/doctrine","commit_stats":{"total_commits":308,"total_committers":7,"mean_commits":44.0,"dds":"0.038961038961038974","last_synced_commit":"1f15703a5369dbd391bee7e9ca7e3dea137a6f55"},"previous_names":[],"tags_count":94,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baraja-core%2Fdoctrine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baraja-core%2Fdoctrine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baraja-core%2Fdoctrine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baraja-core%2Fdoctrine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baraja-core","download_url":"https://codeload.github.com/baraja-core/doctrine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248288353,"owners_count":21078903,"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":["baraja","best-practices","czech-language","database","doctrine","doctrine-2","drivers","entity","nette","nette-database","nette-orm","orm","panel","php","php-database","php-orm","sql"],"created_at":"2024-09-25T05:05:22.761Z","updated_at":"2025-04-10T20:10:43.427Z","avatar_url":"https://github.com/baraja-core.png","language":"PHP","funding_links":["https://github.com/sponsors/janbarasek","https://brj.app","https://baraja.cz","https://php.baraja.cz"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align='center'\u003e\n  \u003cpicture\u003e\n    \u003csource media='(prefers-color-scheme: dark)' srcset='https://cdn.brj.app/images/brj-logo/logo-regular.png'\u003e\n    \u003cimg src='https://cdn.brj.app/images/brj-logo/logo-dark.png' alt='BRJ logo'\u003e\n  \u003c/picture\u003e\n  \u003cbr\u003e\n  \u003ca href=\"https://brj.app\"\u003eBRJ organisation\u003c/a\u003e\n\u003c/div\u003e\n\u003chr\u003e\n\nBaraja Doctrine database 📚\n===========================\n\n![Integrity check](https://github.com/baraja-core/doctrine/workflows/Integrity%20check/badge.svg)\n\nA simple and easy to use, maximum performance database layer with connection to Doctrine, which allows you to use all the advantages of OOP and also has **support for Nette 3**.\n\nThis package automatically installs Doctrine to your project (also sets everything up in the configuration) and runs stably.\n\n🐛 Best debug Tracy panel\n-------------------------\n\nThis package contains the most advanced native tools for debugging your application and SQL queries. You can very easily view the performed queries, click directly on the place of their original invocation and watch the time graphs on the output (with the possibility of analyzing slow queries). Write query types are displayed separately for quick control of data flow.\n\n![Baraja Doctrine debug Tracy panel](doc/tracy-panel-design.png)\n\nThe package also includes advanced logic for debugging corrupted entities and queries directly through Tracy Bluescreen. Using the debugger turns on automatically and you will never lose any useful information.\n\n📦 Installation \u0026 Basic Usage\n-----------------------------\n\nThis package can be installed using [Package Manager](https://github.com/baraja-core/package-manager) which is also part of the Baraja [Sandbox](https://github.com/baraja-core/sandbox). If you are not using it, you will have to install the package manually using this guide.\n\nA model configuration can be found in the `common.neon` file inside the root of the package.\n\nTo manually install the package call Composer and execute the following command:\n\n```shell\n$ composer require baraja-core/doctrine\n```\n\nIn the project's `common.neon` you have to define the database credentials. A fully working example of configuration can be found in the `common.neon` file inside this package. You can define the configuration simply using `baraja.database` extension.\n\nFor example:\n\n```yaml\nbaraja.database:\n   connection:\n      host: 127.0.0.1\n      dbname: sandbox\n      user: root\n      password: root\n```\n\nFor now the package supports only the connection to one database.\n\nPossible connection options: `url`, `pdo`, `memory`, `driver`, `driverClass`, `driverOptions`, `unix_socket`, `host`, `port`, `dbname`, `servicename`, `user`, `password`, `charset`, `portability`, `fetchCase`, `persistent`, `types`, `typesMapping`, `wrapperClass`.\n\n⚙️ Drivers\n----------\n\nIn default settings Doctrine use `MySql` driver.\n\nYou can rewrite it for example for Postgres:\n\nIn your `common.neon` simple type:\n\n```yaml\nbaraja.database:\n   connection:\n      driverClass: Doctrine\\DBAL\\Driver\\PDO\\PgSQL\\Driver\n```\n\n🗺️ Entity mapping\n------------------\n\nIn order for Doctrine to know which classes are **entities** and which **application logic**, it is necessary to set up a mapping.\n\nFor mapping, it is necessary to set the introductory part of the namespace entities and the directory where they occur in the project common.neon. A relative path can also be used.\n\nFor example:\n\n```yaml\norm.annotations:\n   paths:\n      App\\Baraja\\Entity: %rootDir%/app/model/Entity\n```\n\nYou can also specify the `ignore` key, which disables browsing a specific directory.\n\n\u003e **Important warning:**\n\u003e\n\u003e The value of the `%rootDir%`, `%appDir%`, `%wwwDir%`, `%vendorDir%` and `%tempDir%` parameters may be corrupted when running schema generation in CLI mode.\n\u003e To resolve this mistake, please install [Package Manager](https://github.com/baraja-core/package-manager) and call the command as a `composer dump`.\n\nGenerate database structure from entities\n-----------------------------------------\n\nThis package implements a bridge to automatically execute Doctrine commands.\n\nFor example you can simply call:\n\n```shell\nphp www/index.php o:s:u -f --dump-sql\n```\n\nThe command `o:s:u` means `orm:schema-tool:update`.\n\n- `-f` is `flush` to execute changes in SQL,\n- `--dump-sql` renders the list of SQL commands that will be executed.\n\nIf everything will work fine, the command will create the table `core__database_slow_query` which is defined in this package and is ready for logging slow queries.\n\n\u003e **TIP:** If you are using [Package Manager](https://github.com/baraja-core/package-manager), you can simply call the `composer dump` command.\n\n🚀 Performance Benchmarks\n-------------------------\n\nWhen Doctrine is used poorly, it can be unnecessarily slow.\n\nFor more details (in Czech language): https://ondrej.mirtes.cz/doctrine-2-neni-pomala\n\nThis package uses best-practices to increase the performance. It sets automatically `autoGenerateProxyClasses` to `false`, ProxyClasses will be generated when needed by Doctrine.\n\nFor maximum performance is best to save the generated meta data about your entities using Redis: https://www.doctrine-project.org/projects/doctrine-orm/en/latest/reference/caching.html\n\nUUID\n----\n\n**TIP:** Read more about [UUID binary performance](https://php.baraja.cz/uuid-performance) (czech language)\n\nFor unique record (entity) identification the package defines the trait `UuidIdentifier` or `UuidBinaryIdentifier` with already defined all basic best-practice configurations for your entity. The ID will be generated automatically.\n\nFor a better experience please insert two traits to all the entities in your project:\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nnamespace Baraja\\Doctrine\\Entity;\n\n\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Baraja\\Doctrine\\Identifier\\IdentifierUnsigned;\n\n#[ORM\\Entity]\nclass DatabaseEntity\n{\n   use IdentifierUnsigned; // ID trait for entity identifier.\n   // or use uuid:\n   // use UuidIdentifier; // UUID identifier trait\n```\n\nUUID will be generated automatically in PHP.\n\n📄 License\n-----------\n\n`baraja-core/doctrine` is licensed under the MIT license. See the [LICENSE](https://github.com/baraja-core/doctrine/blob/master/LICENSE) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaraja-core%2Fdoctrine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaraja-core%2Fdoctrine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaraja-core%2Fdoctrine/lists"}