blast-project/base-entities-bundle

Libre Informatique Symfony2项目中Doctrine实体的基本行为

0.6.4 2017-11-03 14:56 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:58:48 UTC


README

Build Status Coverage Status License

Latest Stable Version Latest Unstable Version Total Downloads

此包提供了一些工具,用于更好地集成LibrinfoDoctrineBundle行为到Sonata Admin

安装

需求

  • 拥有一个运行的Symfony2环境
  • 创建了一个运行的Symfony2应用(包括数据库和数据库链接)
  • 安装了Composer(这里在/usr/local/bin/composer,/usr/local/bin在路径中)

下载

$ composer require libre-informatique/base-entities-bundle dev-master

将包添加到您的应用中

编辑您的app/AppKernel.php文件并添加您的"libre-informatique/base-entities-bundle"

    // app/AppKernel.php
    // ...
    public function registerBundles()
    {
        $bundles = array(
            // ...

            // The libre-informatique bundles
            new Blast\BaseEntitiesBundle\BlastCoreBundle(),
            new Blast\BaseEntitiesBundle\LibrinfoDoctrineBundle(),
            new Blast\BaseEntitiesBundle\BlastBaseEntitiesBundle(),

            // your personal bundles
        );
    }

配置包

在您的应用程序中激活所需的监听器(将这些行添加到app/config/config.yml

# Enable LibrinfoDocrineBundle event listeners
librinfo_doctrine:
    orm:
        default:
            naming: true
            guidable: true
            timestampable: true
            addressable: true
            treeable: true
            nameable: true
            labelable: true
            emailable: true
            descriptible: true
            searchable: true
            loggable: true
    # List of entity search-able indexed fields
    entity_search_indexes:
        Me\MyBundle\Entity\MyEntity:
            fields:
                - name
                - fulltextName
                - firstname
                - lastname
                - description
                - email
                - url

为您的应用程序中使用的每个ORM连接添加/删除所需的行为。

entity_search_indexes键下,您可以设置应可索引的每个实体的搜索索引。

学习如何使用此包

此包提供的Doctrine行为

  • naming: 根据您的供应商/包/实体提供数据库表命名
  • guidable: 为您的实体提供GUID主键
  • timestampable: 为您的实体提供createdAt / updatedAt字段和doctrine监听器
  • addressable: 为您的实体提供地址字段(地址,城市,邮编,国家...)
  • treeable: 为您的实体提供树结构
  • nameable: 为您的实体提供一个名称字段
  • labelable: 为您的实体提供一个标签字段
  • emailable: 为您的实体提供与电子邮件相关的字段
  • descriptible: 为您的实体提供一个描述字段
  • searchable: 基于所选字段提供搜索索引
  • loggable: 跟踪您的实体更改并能够管理版本

学习如何使用它们,它们如何工作,以及如何根据您的需求创建新的行为,阅读具体文档

学习如何使用libre-informatique/base-entities-bundle

特定表单类型

该包提供了一些表单类型,了解更多信息,阅读具体文档