简体   繁体   中英

Doctrine Complex Inner Join

I'm working on a complex inner join using doctrine. My query is:

    SELECT purchased_items.previewurl, purchased_items.ordernumber, orders.shipByDate, CustomerDesign.designData, fos_user.email
    FROM FYPEmailsBundle:purchased_items purchased_items
    INNER JOIN purchased_items.orders orders
    INNER JOIN orders.CustomerDesign CustomerDesign
    INNER JOIN CustomerDesign.User fos_user                

When I run the query I get Class FYP\\EmailsBundle\\Entity\\orders has no field or association named designData. My CustomerDesign entity looks like:

/**
* @ORM\ManyToOne(targetEntity="orders", inversedBy="CustomerDesign")
* @ORM\JoinColumn(name="orderID", referencedColumnName="customerID")
*/
protected $orders;

My orders Entity looks like:

/**
* @ORM\OneToMany(targetEntity="orders", mappedBy="CustomerDesign")
*/
protected $CustomerDesign;

How do you handle a complex inner join with Doctrine?

Looks like your one to many annotation on Orders is backwards to me. This should be correct.

/**
* @ORM\OneToMany(targetEntity="CustomerDesign", mappedBy="orders")
*/
protected $CustomerDesign;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM