PHPackages                             rroek/entity-manager-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. rroek/entity-manager-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

rroek/entity-manager-bundle
===========================

A small bundle that give you abstract bases to create your Symfony's Entity Managers

v1.0.3(7y ago)73241[4 PRs](https://github.com/RRoek/EntityManagerBundle/pulls)MITPHPPHP &gt;=5.6

Since Mar 11Pushed 7mo ago4 watchersCompare

[ Source](https://github.com/RRoek/EntityManagerBundle)[ Packagist](https://packagist.org/packages/rroek/entity-manager-bundle)[ RSS](/packages/rroek-entity-manager-bundle/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (3)Versions (9)Used By (0)

EntityManagerBundle
===================

[](#entitymanagerbundle)

### Features

[](#features)

- Give you simple interfaces &amp; abstraction to build yours Symfony's Entity Managers

**Table of Contents**

\[TOCM\]

\[TOC\]

Introduction
------------

[](#introduction)

This small bundle give you the ability to build generic Entity Managers for your Symfony Application (2.7 ~ .3.4). The goal is to make managers for all of your entities like [Sensio Symfony Best Practices](http://https://symfony.com/doc/current/best_practices/index.html "Sension Symfony Best Practices") recommend it.

### Advantages

[](#advantages)

Make a manager for an entity permit to lighten your Controller. All the scope (CRUD Create Read Update Delete) of your entity will be managed behind your Entity Manager.

This is useful for big projects or even small/medium projects. Every creation will call the manager like every select, update or delete.

Goal
----

[](#goal)

It's frequent that a team want to make entity managers, but have some technical difficulties. This bundle give you an abstraction to make all your Entity Managers to the same format and already with CRUD methods.

Use
---

[](#use)

### Activate bundle

[](#activate-bundle)

To use it, simply `composer require rroek/entity-manager-bundle`and enable it : in AppKernel.php :

```
     /**
         * @return array
         */
        public function registerBundles()
        {
            $bundles = [
    		[...]
    		new Rroek\EntityManagerBundle\RroekEntityManagerBundle(),
    		[...]
```

### Make your Entity Manager

[](#make-your-entity-manager)

For this example, we will take "MyPersonalEntity" class wich is an *Doctrine Entity* in our Symfony Project. Its class repository is "MyPersonalEntityRepository". Waw you didn't expect it. No ?

Our Entity will have an id, a label, a relation with another entity &amp; getters/setters for it.

#### So let's see interresting things :

[](#so-lets-see-interresting-things-)

I Want to have a manager who dispatch &amp; make job all around my entity. All the CRUD. So lets create our own manager class :

---

In :

```
MyBundle
	Entity
		MyPersonalEntity.php
		...
	Manager
		MyPersonalEntityManager.php
	Repository
		MyPersonalEntityRepository.php
		...

```

---

```
