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
    • 115
    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:

    $qb = $this->getConn()->createQueryBuilder();
    $qb->select('ts.model_id,
                ts.full_name, 
                ts.citizenship, 
                ts.status, 
                ts.updated_at,
                ts.is_itin_verified,
                pm.pm_vendor_id,
                pm.pm_type,
                m.m_profilename as displayname,
                m.m_username as logname,
                m.m_profileImage as profilepic')
    ->from('tbl_model_tax_setting_info', 'ts')   
    ->leftJoin('ts', 'tbl_model', 'm', 'm_id = model_id') 
    ->leftJoin('m', 'tbl_paymentmethod', 'pm', 'pm_m_id = m_id');
    
    // ts is a alias of tbl_model_tax_setting_info
    // you can use join, right join as per your requirement 
    
    $results = $qb->execute()->fetchAll();
    
    

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: