Hello!

I'm relatively new do Doctrine, even though not so much to ORM. Still, I 
need help from other users. =) 

I'm ORM'ming a legacy system with multiple poorly design database schemas, 
so I'm using raw SQL to retrieve my objects' attributes. I'm using 
Doctrine's *named native queries* for that purpose, which works fine for 
simple classes, such as

select p.id   as id, 
       p.name as name, 
       c.name as center 
from professor as p 
join center    as c 
    on p.center_id = c.id 
where p.id = ?

for

class Professor {
    $id;     //integer
    $name;   //string
    $center; //string
    // ... etc.
}

The problem arises when I try to handle more complex associations, such as 
compositions or aggregations in multiple levels. I can't find reference on 
how to put Doctrine to sort this out (example):

select p.id        as id, 
       p.name      as name,
       p.center_id as center_id
from professor as p
where p.id = ?

for

class Professor {
    $id;     //integer
    $name;   //string
    $center; //Center
    // ... etc.
}

and 

select c.id    as id,
        c.name as name
from center as c
where c.id = ?

for

class Center {
    $id;   //integer
    $name; //string
}

What am I missing, guys? Can anybody, please, shed me some light? How can I 
make Doctrine automatically get these *lazy loaded associations while using 
named native queries*?

I imagine that a named query would be able to call for another and so on 
and so forth. How to "nest" named native queries?

Thanks a lot for your precious time. Appreciate it.

Best regards from Brazil,

*Thales Vaz Maciel*
*[email protected]*

-- 
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 https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to