Question: I'd like to auto-populate an invoice in Excel from data I enter into a lesson roster (`blank_monthly.xlsx`).

![enter image description here](https://i.stack.imgur.com/ZJomS.png)

Here I fill in the lesson cost under the date each time they come for tuition.

In the invoice sheet I would like to start writing a customer's name into a cell, I'd like the rest of the table to populate with information from the current month's customer roster.

Can I use `=vlookup` for this to reference the cell I type the client's name into which then pulls all the other information?

Answer: 
Your entity should not know about other entities and the [Entity Manager](https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/EntityManager.php) because of the [separation of concerns](http://fabien.potencier.org/article/49/what-is-symfony2). 

Why don't you simply map your `User` to the appropriate Role(s) (instances of `Permission` entity in your case) using [Doctrine Entity Relationships/Associations](http://symfony.com/doc/current/book/doctrine.html#entity-relationships-associations). It will allow you to access the appropriate permissions of a given user from the `User` instance itself.
In this line: 

```
$em = $this->getDoctrine()->getManager();

```

`$this` refers to the current class, the `User Entity` that does not have a method called `getDoctrine()`. `$this->getDoctrine()` works in controllers where you extend the `Controller` class a subclass of `ContainerAware` which contains the `getDoctrine()` method.

In other terms, this method works only on objects of class container or its subclasses, like this: `$controller->getDoctrine()->getManager()`.

Besides, you don't want to have an EntityManager inside your entity classes, that's not a good way of doing things. You would better use listners to do such stuffs