Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use mysql join in Symfony2

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 120
    Comment on it

    Hello Friends,

    If your are looking to use join with query builder in Symfony2. Please review the code as below and make the changes accordingly:

    1. $qb = $this->getConn()->createQueryBuilder();
    2. $qb->select('ts.model_id,
    3. ts.full_name,
    4. ts.citizenship,
    5. ts.status,
    6. ts.updated_at,
    7. ts.is_itin_verified,
    8. pm.pm_vendor_id,
    9. pm.pm_type,
    10. m.m_profilename as displayname,
    11. m.m_username as logname,
    12. m.m_profileImage as profilepic')
    13. ->from('tbl_model_tax_setting_info', 'ts')
    14. ->leftJoin('ts', 'tbl_model', 'm', 'm_id = model_id')
    15. ->leftJoin('m', 'tbl_paymentmethod', 'pm', 'pm_m_id = m_id');
    16.  
    17. // ts is a alias of tbl_model_tax_setting_info
    18. // you can use join, right join as per your requirement
    19.  
    20. $results = $qb->execute()->fetchAll();
    21.  
    22.  

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: