ResultSetMapping

# ResultSetMapping

In the Doctrine core there is a ResultSetMapping object which works with entity namespaces. The DoctrineBundle provides a way to "shortcut" these entity namespaces.

Unfortunately, this isn't the case with the ResultSetMapper. If you use these shortcuts, the ObjectHydrator will store these values with their shortcut name, but it will search for the relation data based upon their full class name. This gives a PHP notice, "Notice: Undefined index: Full/Entity/Class in vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php line 427"
(https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php#L476)

This ResultSetMapping class provides a small wrapper around the Doctrine ResultSetMapping class and uses the correct key value.

## Code example

### Doctrine ResultSetMapping
This will throw the PHP Notice (and the code will not work, if error suppressing is enabled):
```
$rsm = new \Doctrine\ORM\Query\ResultSetMapping;
$rsm->addEntityResult('AcmeExampleBundle:Entity', 'e');
$rsm->addField…
…

// related object
$rsm->addJoinedEntityResult('AcmeExampleBundle:Related', 'r');
$rsm->addField…
…
```

(The above will only work if you replace the shortcuts by their actual class names, in this case `Acme\ExampleBundle\Entity\Entity` and `Acme\ExampleBundle\Entity\Related`)

### DoctrineBundle ResultSetMapping
This will not throw a PHP Notice (since the shortcuts are converted to actual classes):
```
$rsm = new \Doctrine\Bundle\DoctrineBundle\Query\ResultSetMapping;
$rsm->addEntityResult('AcmeExampleBundle:Entity', 'e');
$rsm->addField…
…

// related object
$rsm->addJoinedEntityResult('AcmeExampleBundle:Related', 'r');
$rsm->addField…
…
```