I have a Zend_DB_Select to create a query which gets different types of 
addresses joined to my transactions base table.

I'm migrating this to Doctrine but do not know where to start with this.

The relevant part of the query in Zend looks like:

$select->joinLeft(
    array('a1' => 'addresses'), 'a1.transactionid = t.id AND a1.address_type 
="INSURED"',
    array('address_name', 'Email', 'Phone1', 'postcode', 
'address_type'))->joinLeft(
    array('a2' => 'addresses'), 'a2.transactionid = t.id AND a2.address_type 
="VEHICLE LOCATION"',
    array('vehicle_address_name'=>'address_name',
            'vehicle_Email'=>'Email',
            'vehicle_Phone1'=>'Phone1',
            'vehicle_location'=>'postcode',
            'vehicle_address_type'=>'address_type'))->joinLeft(
    array('a3' => 'addresses'), 'a3.transactionid = t.id AND a3.address_type 
="INSURER"',
    array('insurer_address_name'=>'address_name'))

So I get each address with a different alias in the result row.

I have created my entities\associations in Doctrine and can run a DQL query 
like:

$dql = "SELECT t, a FROM Transaction t  JOIN t.address a" 

which can get a collection of the addresses.

But is there a way of aliasing the fields without making multiple 
associations in the mappings? Or am I even asking the right question?

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to