ShopwareAG/shopware-4 — pull request #79 by shredding (2013-06-16 17:27:13+00:00)
Title: Shopware\Models\Customer\Billing does not expose underlying relationship to doctrine

The billing class has an imprecise doctrine annotation mapping that hides the underlying relationship of the data structure from doctrine; namely, access to the `countryId` is of no (or little) use for the ORM Framework.

The attached pull request fixes that. I'd recommend to flag the `countryId` and it's getter/setter methods as deprecated as well.

*Example usecase*

Adding the country to the customer listing in the backend requires manipulating the query builder and bypassing the doctrine infrastructure would lead to nasty and overcomplicated workarounds.

With the attached fix it would be as easy as:

```php
public function afterGetListQueryBuilder(Enlight_Hook_HookArgs $arguments)
{
/** @var \Shopware\Components\Model\QueryBuilder $builder */
$builder = $arguments->getReturn();
$builder->leftJoin('billing.country', 'countries');
$builder->addSelect('countries.name as countryname');
$arguments->setReturn($builder);
}
```