micayael/native-query-from-file-builder-bundle
最新稳定版本:2.0.6
Composer 安装命令:
composer require micayael/native-query-from-file-builder-bundle
包简介
Bundle for execute native queries from yaml files
README 文档
README
This bundle let you write your SQL SELECT sentences into yaml files for better organization and then execute them within the application
Installation
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
- Symfony <5.4
$ composer require micayael/native-query-from-file-builder-bundle
- Symfony >=5.4
$ composer require micayael/native-query-from-file-builder-bundle:~2.0
Applications that don't use Symfony Flex
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
- Symfony <5.4
$ composer require micayael/native-query-from-file-builder-bundle
- Symfony >=5.4
$ composer require micayael/native-query-from-file-builder-bundle:~2.0
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php file of your project:
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Micayael\NativeQueryFromFileBuilderBundle\NativeQueryFromFileBuilderBundle(), ); // ... } // ... }
Configuration
Applications that use Symfony Flex
native_query_from_file_builder: sql_queries_dir: '%kernel.project_dir%/config/app/queries' # optional (default: '%kernel.project_dir%/config/app/queries') default_connection: default # see your doctrine.yaml to select the connection you want to use by default - optional default: 'default') file_extension: yml # yaml file extension - optional (default: yaml) cache_sql: true # caches sql statements to avoid processing yaml files in each request. Recommended for production - optional (default: true)
- Symfony 5.4
It is possible to define different configurations for different environments by replicating the file inside the folder corresponding to the environment or with a syntax like the following:
native_query_from_file_builder: default_connection: secondary_connection cache_sql: true when@dev: native_query_from_file_builder: cache_sql: false
Applications that don't use Symfony Flex
Add your configuration in app/config/config.yml
Full Documentation and examples
统计信息
- 总下载量: 6.73k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-07-25