glavweb / data-schema-bundle
该包最新版本(v2.2.0)没有可用的许可证信息。
GLAVWEB DataSchemaBundle
v2.2.0
2023-05-23 07:56 UTC
Requires
- php: >=7.2.5
- ext-json: *
- doctrine/doctrine-bundle: ^2.0
- doctrine/orm: ^2.3
- symfony/config: ^4.0|^5.0|^6.0
- symfony/dependency-injection: ^4.0|^5.0|^6.0
- symfony/finder: ^4.0|^5.0|^6.0
- symfony/security-bundle: ^4.0|^5.0|^6.0
- symfony/twig-bridge: ^4.0|^5.0|^6.0
- symfony/yaml: ^4.0|^5.0|^6.0
README
使用composer获取此捆绑包
通过在Symfony项目的根目录下运行此命令添加GlavwebDataSchemaBundle
php composer.phar require glavweb/data-schema-bundle
启用捆绑包
要开始使用捆绑包,请在您的应用程序的kernel类中注册捆绑包
// app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Glavweb\DataSchemaBundle\GlavwebDataSchemaBundle(), // ... ); }
配置捆绑包
此捆绑包旨在即装即用。为了运行此捆绑包,您只需配置映射即可。
# app/config/config.yml # Add hydrators to Doctrine doctrine: orm: hydrators: DatagridHydrator: Glavweb\DataSchemaBundle\Hydrator\Doctrine\DatagridHydrator glavweb_data_schema: default_hydrator_mode: DatagridHydrator data_schema: dir: "%kernel.root_dir%/config/data_schema" scope: dir: "%kernel.root_dir%/config/scopes"
基本用法
定义数据模式
# app/config/data_schema/article.schema.yml
schema:
class: AppBundle\Entity\Article
properties:
id:
name:
slug:
body:
定义作用域
# app/config/scopes/article/short.yml
scope:
name: