data-access-kit/data-access-kit-symfony

dev-main 2024-06-07 12:25 UTC

This package is auto-updated.

Last update: 2024-09-07 13:12:17 UTC


README

快速开始

将包添加到 config/bundles.php

<?php

return [
    // ...
    Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], // DataAccessKit depends on Doctrine\DBAL
    DataAccessKit\Symfony\DataAccessKitBundle::class => ['all' => true],
];

(或者如果不使用 MicroKernelTrait,则添加到 Kernel::registerBundles()。)

然后配置到你的仓库类的路径在 config/packages/data_access_kit.yaml

data_access_kit:
  repositories:
    # similar to how autoload in composer.json works
    App\Repository\:
      path: %kernel.project_dir%/src/Repository

就这样!遵循快速开始指南了解更多信息。

安装

composer require data-access-kit/data-access-kit-symfony@dev-main

要求

  • PHP 8.3 或更高版本。
  • Symfony 7.0 或更高版本。

配置

data_access_kit:
  default_database: default # this database Persistence will be aliased to PersistenceInterface
  databases:
    default:
      connection: doctrine.dbal.default_connection # service reference to Doctrine\DBAL\Connection
    other:
      connection: doctrine.dbal.other_connection
  repositories:
    App\Repository: # namespace prefix
      path: %kernel.project_dir%/src/Repository # path to repository classes
      exclude: # excluded file paths, you can use glob patterns
        - Support/**
        - Tests/**
  name_converter: DataAccessKit\Converter\DefaultNameConverter # service reference to NameConverterInterface, if the service doesn't exist, the string is considered to be a class name and a service is added to the container
  value_converter: DataAccessKit\Converter\DefaultValueConverter # service reference to ValueConverterInterface, the same behavior as with name_converter

贡献

此仓库自动从主仓库分离。请在那里提交问题和拉取请求。

许可证

在 MIT 许可证下发布。请参阅 LICENSE