join() публичный Метод

public join ( $joinTable, $joinKey, $idName, $alias = null, $type = 'LEFT', $on = [] )
Пример #1
0
 /**
  * @test
  */
 public function shouldReturnSelectWithMultipleJoinsWithAliases()
 {
     //given
     $query = new Query();
     $query->table = 'products';
     $query->join('categories', 'id_category', 'id_category', 'c')->join('orders', 'id', 'id_product', 'o')->where('id = ?', 1);
     //when
     $sql = $this->_dialect->buildQuery($query);
     //then
     $expected = 'SELECT * FROM products LEFT JOIN categories AS c ON c.id_category = products.id_category LEFT JOIN orders AS o ON o.id = products.id_product WHERE id = ?';
     $this->assertEquals($expected, $sql);
 }