sideclick/entity-helper-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sideclick/entity-helper-bundle

Composer 安装命令:

composer require sideclick/entity-helper-bundle

包简介

Bundle for Symfony 2.6+ which introduces entity helper classes for each Doctrine entity in your bundle

README 文档

README

Bundle for Symfony 2.6+ which introduces entity helper classes for each Doctrine entity in your bundle

Installation

Step 1: Add the following to the "require" section of composer.json

"sideclick/entity-helper-bundle": "dev-master"

OR just require the bundle from the commandline

composer require sideclick/entity-helper-bundle

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Sideclick\EntityHelperBundle\SideclickEntityHelperBundle(),
    );
}

Usage

Entity helper classes should be defined in the /Entity/Helper directory of your bundle, here is the basic structure of an Entity Helper class for an entity named 'User':

//YourBundle\Entity\Entity\Helper\UserHelper.php

namespace YourBundle\Entity\Helper;

use Sideclick\EntityHelperBundle\Entity\Helper\HelperAbstract;
use YourBundle\Entity\User;

class UserHelper extends HelperAbstract
{
    protected $_user;

    public function setUser(User $user)
    {
        $this->_user = $user;
    }

}

There is a service named sideclick_entity_helper.entity_helper_factory which makes it easy to get an instance of an Entity Helper for an object, for example, in your controller you could do:

$userHelper = $this->get('sideclick_entity_helper.entity_helper_factory')->getEntityHelper($user);

Also, there is a twig function to get a helper in your templates:

get_entity_helper(user)

More documentation to come...

统计信息

  • 总下载量: 335
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 9
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固