Could you make a gist with a more extensive example?

Specifically, what is missing here is:

 * resultset map
 * actual results
 * expected results

A test case would the ideal scenario.


Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 24 June 2016 at 22:21, Thales Maciel <[email protected]> wrote:

> 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] <[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.
>

-- 
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